I\'m trying to loop through only the csv files in a folder that contains many kinds of files and many folders, I just want it to list all of the .csv files in this folder.>
Use the glob module: http://docs.python.org/2/library/glob.html
import glob path = "path/to/dir/*.csv" for fname in glob.glob(path): print(fname)