Iterating all files in a directory
andy at eastonwest.co.uk
Sun Jan 26 13:57:10 CET 2003
On Sunday 26 Jan 2003 1:20 am, Mongryong wrote:
> How can iterate through all the files in a directory?
> ie. obtain a list of all the file's name
for file in os.listdir("./"):
Have a good look at the os module and its submodule path. Note that
os.listdir() returns a complete list of the files in the subdirectory, and
that no file specification is necessary, or allowed. Be aware that there may
be issues with the handling of unicode characters in filenames.
hope this helps
More information about the Python-list