[Tutor] os.path.walk
Alan Gauld
alan.gauld at freenet.co.uk
Tue Aug 22 18:04:42 CEST 2006
> Yes, that is the right way to do it and it will work fine. Something
> like
>
> class Walker(object):
> def walk(self, base):
> os.path.walk(base, self.callback, None)
>
> What happens is, when Python looks up self.callback it converts the
> method to a "bound method".
Aargh! I should have remembered that. No need for lambdas here.
Apologies...
> But, if you are using a recent version of Python (2.3 or greater)
> you should look at os.walk(), it is easier to use than
> os.path.walk().
But I did suggest that too :-)
Alan G.
More information about the Tutor
mailing list