Python os.path.walk() method
Posted
by Aaron Moodie
on Stack Overflow
See other posts from Stack Overflow
or by Aaron Moodie
Published on 2010-05-29T07:56:24Z
Indexed on
2010/05/29
8:02 UTC
Read the original article
Hit count: 156
I'm currently using the walk
method in a uni assignment. It's all working fine, but I was hoping that someone could explain something to me.
in the example below, what is the a
parameter used for on the myvisit
method?
>>> from os.path import walk
>>> def myvisit(a, dir, files):
... print dir,": %d files"%len(files)
>>> walk('/etc', myvisit, None)
/etc : 193 files
/etc/default : 12 files
/etc/cron.d : 6 files
/etc/rc.d : 6 files
/etc/rc.d/rc0.d : 18 files
/etc/rc.d/rc1.d : 27 files
/etc/rc.d/rc2.d : 42 files
/etc/rc.d/rc3.d : 17 files
/etc/rc.d/rcS.d : 13 files
© Stack Overflow or respective owner