Problems with os.walk

Hrvoje Niksic hniksic at xemacs.org
Thu May 8 04:10:18 EDT 2008


<Dominique.Holzwarth at ch.delarue.com> writes:

>     (dirpath, dirnames, filenames) = os.walk(scriptPath)

You're supposed to loop over values in different directories, like
this:

for dirpath, dirnames, filenames in os.walk(scriptPath):
    ... handle dirpath with dirnames and filenames ...

The loop will be executed for each subdirectory (direct and indirect)
of scriptPath.



More information about the Python-list mailing list