Kaydet (Commit) f5ed9819 authored tarafından Skip Montanaro's avatar Skip Montanaro

Avoid using 'dir' as a variable name and use os.path.join() to create

paths.
üst fc1efa37
...@@ -129,12 +129,12 @@ Example: ...@@ -129,12 +129,12 @@ Example:
import os, sys import os, sys
from stat import * from stat import *
def walktree(dir, callback): def walktree(top, callback):
'''recursively descend the directory rooted at dir, '''recursively descend the directory tree rooted at top,
calling the callback function for each regular file''' calling the callback function for each regular file'''
for f in os.listdir(dir): for f in os.listdir(top):
pathname = '%s/%s' % (dir, f) pathname = os.path.join(top, f)
mode = os.stat(pathname)[ST_MODE] mode = os.stat(pathname)[ST_MODE]
if S_ISDIR(mode): if S_ISDIR(mode):
# It's a directory, recurse into it # It's a directory, recurse into it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment