]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#16420: document a way to escape metacharacters in glob/fnmatch.
authorEzio Melotti <ezio.melotti@gmail.com>
Sat, 17 Nov 2012 15:38:11 +0000 (17:38 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Sat, 17 Nov 2012 15:38:11 +0000 (17:38 +0200)
Doc/library/fnmatch.rst
Doc/library/glob.rst

index 4ba6b77f8ed74b555474e1db25522e650814ab73..e0434b0c1905e15929edeb626d42d8293dc281e6 100644 (file)
@@ -29,6 +29,9 @@ special characters used in shell-style wildcards are:
 | ``[!seq]`` | matches any character not in *seq* |
 +------------+------------------------------------+
 
+For a literal match, wrap the meta-characters in brackets.
+For example, ``'[?]'`` matches the character ``'?'``.
+
 .. index:: module: glob
 
 Note that the filename separator (``'/'`` on Unix) is *not* special to this
@@ -74,8 +77,6 @@ patterns.
 
    Return the shell-style *pattern* converted to a regular expression.
 
-   Be aware there is no way to quote meta-characters.
-
    Example:
 
       >>> import fnmatch, re
index 3d31c116c8378f5f22cec944265554bec808eae8..25843619c0d8297b5c942ca442bfb144efbe4ef7 100644 (file)
@@ -19,6 +19,9 @@ matched.  This is done by using the :func:`os.listdir` and
 subshell.  (For tilde and shell variable expansion, use
 :func:`os.path.expanduser` and :func:`os.path.expandvars`.)
 
+For a literal match, wrap the meta-characters in brackets.
+For example, ``'[?]'`` matches the character ``'?'``.
+
 
 .. function:: glob(pathname)