glob and os.path.walk (was Re: pygrep)

Alex Martelli aleaxit at yahoo.com
Wed May 2 10:50:17 EDT 2001


"Mike Brenner" <mikeb at mitre.org> wrote in message
news:mailman.988808473.19351.python-list at python.org...
    [snip]
> Therefore, it would be nice if Python had a way of expanding
> the second argument, both the stars and question marks, and

Check out module glob in the standard Python library.

> also the ability to iterate through all files at all levels.

Also check out function walk() in module os.path, also
in the standard Python library.

> This would be WITHIN python, not depending on the operating
> system to do it.

They delegate appropriately to the operating system (how
else would they find out about what files live in what
directory, if not by appropriately asking the os...?).


Alex






More information about the Python-list mailing list