trouble with os.path.exists() and wildcards

Erik Max Francis max at alcyone.com
Mon Nov 17 14:09:58 EST 2003


Jeremy Fincher wrote:

> Erik Max Francis <max at alcyone.com> wrote in message
> news:<3FB8A5B8.3D359C27 at alcyone.com>...
>
> > Fernando Rodriguez wrote:
> >
> > > How can I check for the xistence of any file that matches a
> > > wildcard?
> > >
> > > For example: ppis-*.iss
> > >
> > > os.path.exists() doesn't expand the wildcard...
> >
> > Use glob.glob and then os.path.exists in a loop.
> 
> Wouldn't the glob.glob only return files that actually exist?

Sure, but isn't that what he wants?  He wrote, "the [existence] of any
file that maches a wildcard."  He's obviously talking about existing
files.

Besides, what else could expanding a wildcard mean except enumerating
every possible match?

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ 
\__/ Why don't you grow up for crying out loud?
    -- Capt. Benjamin "Hawkeye" Pierce




More information about the Python-list mailing list