# retest.py import re f = file('/usr/share/dict/words', 'r') pat = re.compile(r'ear.*ness$') for s in f: if pat.search(s): print s,