[issue8402] glob returns empty list with "[" character in the folder name

Dan Gawarecki report at bugs.python.org
Wed May 26 19:09:11 CEST 2010


Dan Gawarecki <dan_gawarecki at datacard.com> added the comment:

Shouldn't the title be updated to indicate the fnmatch is the true source of the behavior (I'm basing this on http://docs.python.org/library/glob.html indicating the fnmatch is invoked by glob).  I'm not using glob, but fnmatch in my attempt to find filenames that look like "Ajax_[version2].txt".  

If nothing else, it would have helped me if the documentation would state whether or not the brackets could be escaped.  It doesn't appear from my tests (trying "Ajax_\[version2\].txt" and "Ajax_\\[version2\\].txt") that 'escaping' is possible, but if the filter pattern gets turned into a regular expression, I think escaping *would* be possible.  Is that a reasonable assumption?

I'm running 2.5.1 under Windows, and this is my first ever post to the bugs list.

----------
nosy: +Aquinas

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8402>
_______________________________________


More information about the Python-bugs-list mailing list