Iterating all files in a directory

Peter Hansen peter at engcorp.com
Sun Jan 26 16:08:48 CET 2003


Mongryong wrote:
> 
> In particular, I would like to obtain the names of all the files that
> end in a certain suffix (ie. .txt).

import glob
files = glob.glob('*.txt')

-Peter




More information about the Python-list mailing list