Listing files with special names
katz at underlevel.net
Sun Sep 10 01:58:10 CEST 2000
gustafl at algonet.se (Gustaf Liljegren) writes:
> I bet there's a function for this, but I can't find it. I have directory
> with several files and want a list of all files with names ending with
> "*.txt". os.listdir() is as close as I get, but as I get all files with
> that I guess I have to run a regexp on them to aquire only the textfiles.
> Any easier way?
The `glob' module does this for you:
Jordan Katz <katz at underlevel.net>
More information about the Python-list