Python/2.7 simple coding(+ c++)

파이썬챌린지.com 3

qkqhxla1 2014. 8. 15. 18:15


http://www.pythonchallenge.com/pc/def/equality.html

하나의 소문자가 정확히 3개의 대문자 사이에 있다. 그러면 

소문자 1개,대문자3개, 소문자1개 대문자3개 소문자 1개 이리 있다는 소리 같습니다.

#정규식 모듈 re
# -*- coding: euc-kr -*-
import urllib2,re

req = urllib2.Request('http://www.pythonchallenge.com/pc/def/equality.html')
res = urllib2.urlopen(req)
reads = res.read()
str = re.findall('[a-z][A-Z]{3}([a-z])[A-Z]{3}[a-z]',reads)
answer = ''

for i in range(0,len(str)):
    answer = answer + str[i]

print answer

답은 linkedlist

'Python > 2.7 simple coding(+ c++)' 카테고리의 다른 글

파이썬챌린지.com 5  (0) 2014.08.16
파이썬챌린지.com 4  (0) 2014.08.15
파이썬챌린지.com 2  (0) 2014.08.15
파이썬챌린지.com 1  (1) 2014.08.15
파이썬챌린지.com 0  (0) 2014.08.15