Searching through more than one file.

Paul Rubin no.email at nospam.invalid
Sun Dec 28 13:43:13 EST 2014


Seymore4Head <Seymore4Head at Hotmail.invalid> writes:
> How can I modify the code to search through a directory of files that
> have different filenames, but the same extension?

Use the os.listdir function to read the directory.  It gives you a list
of filenames that you can filter for the extension you want.

Per Mark Lawrence, there's also a glob function.



More information about the Python-list mailing list