mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Avoid using 'dir' as a variable name and use os.path.join() to create
paths.
This commit is contained in:
		
							parent
							
								
									fc1efa371a
								
							
						
					
					
						commit
						f5ed9819b0
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue