On 2025-05-28 10:59:16 +0300, Roland Mueller via Python-list wrote: > ke 28.5.2025 klo 1.45 Thomas Passin ([email protected]) kirjoitti: > > On 5/27/2025 10:41 AM, Roland Mueller via Python-list wrote: > > > To get a list of files in a given directory one can use glob.glob and > > > > The OP had a different problem. He wanted to find a config file of > > known name that could be in one of several locations. > > > > This can be done by replacing the star wildcard the join(dir, '*') with a > filename or filename glob pattern. > >>> tmp_files = [] > >>> for dir in ['/tmp', '/var/tmp']: > ... tmp_files += [f for f in glob(join(dir, filename_to_find)) if > isfile(f) ]
But then the glob is useless.
Just try to open the file as Chris already demonstrated.
hjp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | [email protected] | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman3//lists/python-list.python.org
