can't use "glog" to find the path with square bracket

winterTTr winterttr at
Tue Apr 28 03:08:56 CEST 2009

I want to list the file with glob .
The path( which is a directory ) is contain square bracket as "[ab]
.  However , i can't find how to do it rightly with glob .

with the coding :

import glob
glob.glob('[ab]xxx' )

and with the path "[ab]xxx" really exits.
result : []

Is there a way to do it rightly ?

And i know the fact that  [ is a special character for glob().
But how can i escape it when using glob?

 Python : 2.5
 Platform : Win XP

More information about the Python-list mailing list