diff options
| author | Skip Montanaro <skip@pobox.com> | 2003-06-19 18:10:37 +0000 |
|---|---|---|
| committer | Skip Montanaro <skip@pobox.com> | 2003-06-19 18:10:37 +0000 |
| commit | ab2d8a676a870a4609c9feec8988099da4ee3f53 (patch) | |
| tree | ed29a4c2749319d8d65d0f971adf69d01305d4ba /Doc/lib/libstat.tex | |
| parent | 36b6f4165d0967f2d3452a3d2460f6b28efef822 (diff) | |
| download | cpython-ab2d8a676a870a4609c9feec8988099da4ee3f53.tar.gz | |
Avoid using 'dir' as a variable name and use os.path.join() to create
paths.
Diffstat (limited to 'Doc/lib/libstat.tex')
| -rw-r--r-- | Doc/lib/libstat.tex | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/lib/libstat.tex b/Doc/lib/libstat.tex index acad5e0776..74ccc3777b 100644 --- a/Doc/lib/libstat.tex +++ b/Doc/lib/libstat.tex @@ -129,12 +129,12 @@ Example: import os, sys from stat import * -def walktree(dir, callback): - '''recursively descend the directory rooted at dir, +def walktree(top, callback): + '''recursively descend the directory tree rooted at top, calling the callback function for each regular file''' - for f in os.listdir(dir): - pathname = '%s/%s' % (dir, f) + for f in os.listdir(top): + pathname = os.path.join(top, f) mode = os.stat(pathname)[ST_MODE] if S_ISDIR(mode): # It's a directory, recurse into it |
