use the glob module
import os, glob dor = the path you want for dir, subdir, files in os.walk(dor): for file in files: if glob.fnmatch.fnmatch(file,"*.txt"): do what you want -- http://mail.python.org/mailman/listinfo/python-list
use the glob module
import os, glob dor = the path you want for dir, subdir, files in os.walk(dor): for file in files: if glob.fnmatch.fnmatch(file,"*.txt"): do what you want -- http://mail.python.org/mailman/listinfo/python-list