[docs] [issue8402] Add a way to escape metacharacters in glob/fnmatch

Ezio Melotti report at bugs.python.org
Mon Oct 15 16:16:14 CEST 2012


Ezio Melotti added the comment:

I think the escaping workaround should be documented in the glob and/or fnmatch docs.  This way users can simply do:

import glob
glob.glob("c:\abc\afolderwith[[]test]\*")

rather than

import glob
import fnmatch
glob.glob(fnmatch.escape("c:\abc\afolderwith[test]\") + "*")

The function might still be useful with patterns constructed programmatically, but I'm not sure how common the problem really is.

----------

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


More information about the docs mailing list