Title: can't use "glog" to find the path with square bracket
Type: resource usage Stage:
Components: Library (Lib), Regular Expressions, Windows Versions: Python 2.5
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, winterTTr
Priority: normal Keywords:

Created on 2009-04-27 07:55 by winterTTr, last changed 2009-04-27 10:53 by amaury.forgeotdarc. This issue is now closed.

Messages (2)
msg86648 - (view) Author: winterTTr (winterTTr) Date: 2009-04-27 07:55
I want to list the file with glob .
The path( which is a directory ) is contain square bracket as "[ab]xxx" 
.  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 ?
Or it is a bug ?
msg86654 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-04-27 10:53
The bug tracker is not here to get help.
Please ask this kind of question on the comp.lang.python newsgroup.
(they will tell you that [ is a special character for glob(), and how to
escape it)
Date User Action Args
2009-04-27 10:53:00amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg86654

resolution: not a bug
2009-04-27 07:55:12winterTTrcreate