os.walk trouble

The Prophet dndfan at hotpop.com
Thu Jun 1 14:50:13 EDT 2006


Kent Johnson wrote:
> The Prophet wrote:
> > As my first Python script, I am trying to make a program that recurses
> > a directory searching for files whose names match a pattern.
>
> If your patterns are simple (supported by fnmatch), the path module
> makes this very easy:
> import path
> for f in path.path(dirname).walkfiles('*.foo'):
>    # process a .foo file here
>
> http://www.jorendorff.com/articles/python/path/index.html
>
> Kent

Well, it ain't that simple, but the suggestion is helpful, since I am
only a beginner. Thanks for everything, friends, now this aspect is
clear to me.




More information about the Python-list mailing list