import re print [n.group(1) for n in re.finditer('(([a-z]+)\.(txt|html))', 'abc.txt def.html')]
Standard input is empty
['abc.txt', 'def.html']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!