summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-11-17 17:38:11 +0200
committerEzio Melotti <ezio.melotti@gmail.com>2012-11-17 17:38:11 +0200
commitd7f1b72961a92a72b609607645c16ee993989571 (patch)
tree97ada60b5534c13780a7c843c70a1cc4941d51e1
parent5f83942e7fe1c7e39bb1e5342591c7b12b2854da (diff)
downloadcpython-d7f1b72961a92a72b609607645c16ee993989571.tar.gz
#16420: document a way to escape metacharacters in glob/fnmatch.
-rw-r--r--Doc/library/fnmatch.rst5
-rw-r--r--Doc/library/glob.rst3
2 files changed, 6 insertions, 2 deletions
diff --git a/Doc/library/fnmatch.rst b/Doc/library/fnmatch.rst
index 4ba6b77f8e..e0434b0c19 100644
--- a/Doc/library/fnmatch.rst
+++ b/Doc/library/fnmatch.rst
@@ -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
diff --git a/Doc/library/glob.rst b/Doc/library/glob.rst
index 3d31c116c8..25843619c0 100644
--- a/Doc/library/glob.rst
+++ b/Doc/library/glob.rst
@@ -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)