Is there an alternative to os.walk?

hanumizzle hanumizzle at gmail.com
Sun Oct 8 06:53:24 CEST 2006


On 10/8/06, Tim Roberts <timr at probo.com> wrote:

> Umm, may I point out that you don't NEED the "os.path.exists" call, because
> you are already being HANDED a list of all the filenames in that directory?
> You could "dirtest" with this much faster routinee:
>
> def dirtest(a_dir,filenames):
>     for f in ['a','b','c']:
>         if not f in filenames:
>             return 0
>     return 1

Or False / True for sufficiently new versions of Python. :)

-- Theerasak



More information about the Python-list mailing list