Message30301
Logged In: YES
user_id=703365
Not a bug. "[abc]" matches exactly one character which may be "a", "b" or "c".
Therefore "[ ]" matches one space character. If you want a literal "[", put it in brackets,
e. g. glob.glob("C:\\[[] ]\\*").
---
By the way, do you think this problem is common enough to warrant the addition of a
fnmatch.escape() function? I have something like this in mind:
>>> import re
>>> r = re.compile("(%s)" % "|".join(re.escape(c) for c in "*?["))
>>> def escape(s):
... return r.sub(r"[\1]", s)
...
>>> escape("c:\\[a-z]\\*")
'c:\\[[]a-z]\\[*]'
|
|
Date |
User |
Action |
Args |
2007-08-23 14:44:03 | admin | link | issue1580472 messages |
2007-08-23 14:44:03 | admin | create | |
|