os.path.walk(path, visit, arg)

  • Calls the function visit with arguments (arg, dirname, names) for each directory in the directory tree rooted at path (including path itself, if it is a directory).


    • The argument dirname specifies the visited directory, the argument names lists the files in the directory (gotten from os.listdir(dirname)). 


    • The visit function may modify names to influence the set of directories visited below dirname, e.g. to avoid visiting certain parts of the tree. 


    • (The object referred to by names must be modified in place, using del or slice assignment.)

No comments:

Post a Comment