Saturday, 23 April 2011

Python Challenge #003 - equality

The bodyguards seem to refer to capital letters. Use regular expressions to parse.
>>> import re
>>> text = urlopen('http://www.pythonchallenge.com/pc/def/ocr.html').read()
>>> text = text.decode()
>>> print(''.join(re.findall('[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]', text)))
linkedlist

No comments:

Post a Comment