Mega Code Archive
Categories
/
Python Tutorial
/
String
Searching Strings for Specific EndingsBeginnings
import os for f in os.listdir('C:\\txtfiles'): if f.endswith('.py'): print "Python file: " + f elif f.endswith('.txt'): print "Text file: " + f