|
|
От: |
ShaggyOwl
|
http://www.rsdn.org |
| Дата: | 14.04.10 14:22 | ||
| Оценка: | |||
S>def visit(arg, dirname, names):
S> for n in names:
S> print os.path.join(dirname, n)
S>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.)