walk library function

Shalabh Chaturvedi shalabh at pspl.co.in
Thu Feb 24 07:49:50 EST 2000


Milos Prudek wrote:
> I do not quite understand walk library function. Python Library
> Reference says that walk calls function 'visit'.
>
> - What is visit's syntax?
> - Or does 'visit' stand for any external program, like 'ls -l'?

'visit' is any function _you_ define. Then you pass the function name to walk
and your function will get called from walk.

Try this:
----
def myFunc(ar, dirn, nams):
    print "Someone (wonder who?) called myFunc with parameters:",
             ar, dirn, nams
    return


walk('c:\\', myFunc, 'hoho')
---

Hope this helps

Shalabh






More information about the Python-list mailing list