1 2 3 4
import re def find_adverbs(text): for m in re.finditer(r"\w+ly", text): return ('%d-%d: %s' % (m.start(), m.end(), m.group(0)))