Friday, April 15, 2011

Python Challenge level 3

import re

FILE_PATH = 'l3-text'

f = open(FILE_PATH)
text = ''.join(f.readlines())
print ''.join([ l[4] for l in re.findall('[a-z][A-Z]{3}[a-z][A-Z]{3}[a-z]', text) ])

f.close()

為了過這關,我花了二十分鐘看了Regular Expression

感謝Buggy Ga Ga幫我Debug

0 comments:

Post a Comment