> The os.walk function walks the operating systems directory tree.

Yup.

> This seems to work, but I don't quite understand the tupple that is
> returned...
> Can someone explain please?
> 
> for root, dirs, files in os.walk('/directory/'):
>       print root
> #     print dirs
> #     print files


As cheesy as it may sound, try uncommenting the two commented 
lines.  For a more explicit variant:

        print repr(dirs)
        print repr(files)

You'll notice that they're lists.

In the directory "root", you'll find the subdirectories given in 
the list "dirs" and you'll find the files given in the list "files".

-tkc



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to