trouble with os.path.exists() and wildcards

Eric Williams s-rube at uselessbastard.net
Mon Nov 17 08:13:39 EST 2003


Fernando Rodriguez wrote:

> Hi,
> 
> 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...

have you taken a look at glob.glob?

import glob, os

dirname="."
filespec="ppis-*.iss"

print glob.glob(os.path.join(dirname, filespec))

cya,
Eric

-- 
---
s- should be removed to contact me...




More information about the Python-list mailing list