os.walk() dirs and files
rtilley
rtilley at vt.edu
Wed Feb 8 08:34:35 EST 2006
rtilley wrote:
> Hello,
>
> When working with file and dir info recursively on Windows XP. I'm going
> about it like this:
>
> for root, dirs, files in os.walk(path):
> for f in files:
> ADD F to dictionary
> for d in dirs:
> ADD D to dictionary
>
> Is it possible to do something such as this:
>
> for root, dirs, files in os.walk(path):
> for f,d in files, dirs:
> ADD F|D to dictionary
Just to clarify. In this particular case, I do not need to differentiate
between files and dirs... so would it be possible to do something such
as this:
for root, dirs, files in os.walk(path):
for fs_object in files, dirs:
ADD fs_object to dictionary
More information about the Python-list
mailing list