From: Skip Montanaro Date: Thu, 19 Jun 2003 18:10:37 +0000 (+0000) Subject: Avoid using 'dir' as a variable name and use os.path.join() to create X-Git-Tag: v2.3c1~372 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f5ed9819b0528fac67a6dc1146e8cf96399e42cc;p=thirdparty%2FPython%2Fcpython.git Avoid using 'dir' as a variable name and use os.path.join() to create paths. --- diff --git a/Doc/lib/libstat.tex b/Doc/lib/libstat.tex index acad5e07760b..74ccc3777be1 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