[Tutor] clarification on os.path.walk

Chandrashekar mailchansek at yahoo.com
Tue Jun 12 08:16:37 CEST 2007


Hi,

I have a program like this.

import os,os.path
import re

def print_files(arg,dir,files):
    '''print 'arg', arg
    print 'dir', dir
    print 'files',files'''
    for file in files:
        path = os.path.join(dir,file)
        path = os.path.normcase(path)
        if re.search(r".*\.txt",path):
            print path
 

os.path.walk('.',print_files,1)

My doubt is that what does the argument stand for in this program?
os.path.walk('.',print_files,0)
os.path.walk('.',print_files,1)
os.path.walk('.',print_files,2)

all seems to be rendering the same output. Can anyone clarify when this argument is used.

Thanks,
Chandru



 
---------------------------------
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070611/7cc119aa/attachment.html 


More information about the Tutor mailing list