os.access with wildcards

mike no.mail.here.at.here at gmail.com
Fri Oct 7 11:26:32 EDT 2005


Test for the existence of one or more matches of the wildcard
expression.

For example:

    Are there any files that begin with 2005?

This doesn't work (wish it did):

     os.access('2005*',os.F_OK)

However, these work arounds do the job:

    glob.glob('2005*')==[]

as does this bash command:

    os.system('[ -e  2005* ]' )

The 1st is not very readable and the 2nd has portability issues.




More information about the Python-list mailing list