[Tutor] glob module

Gerrit gerrit at nl.linux.org
Wed Feb 4 11:30:08 EST 2004


Isr Gish wrote:
> Docs
>     recipes
>         new
>         old
>     help
>         all
> ...
> I want to find all files with "a*.txt" from whole tree of Docs how would I do that. I understand that I could iterate the whole tree. But what I would like to know, if it can be done, with the glob module.

If it's always 3 levels deep, you can use '*/*/a*.txt'.
That makes using os.walk unnecesary.

Gerrit.

-- 
PrePEP: Builtin path type
    http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html
Asperger's Syndrome - a personal approach:
	http://people.nl.linux.org/~gerrit/english/



More information about the Tutor mailing list