List of files to be opened
Fredrik Lundh
fredrik at pythonware.com
Thu Jan 26 15:15:58 EST 2006
Carl J. Van Arsdall wrote:
> > os.walk is your friend. Its has wonderful functionality.
>
> Don't you mean os.path.walk ?
os.walk is a generator-based version of os.path.walk. instead of putting
the logic in a callback function, you put it in a for loop:
for root, dirs, files in os.walk(top):
for file in files:
file = os.path.join(root, file)
print file, "..."
os.listdir and glob.glob are still good choices if you just want the files in
a given directory.
</F>
More information about the Python-list
mailing list