diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-17 15:38:11 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-17 15:38:11 (GMT) |
commit | 1df43d33d2f17584639759519e290021b063485c (patch) | |
tree | b3792c4776877dc49a9eb870db6691cee121bdaf /Doc | |
parent | 820f2bdaf9a69b96175e32ae484a3b5f27054baf (diff) | |
download | cpython-1df43d33d2f17584639759519e290021b063485c.zip cpython-1df43d33d2f17584639759519e290021b063485c.tar.gz cpython-1df43d33d2f17584639759519e290021b063485c.tar.bz2 |
#16420: document a way to escape metacharacters in glob/fnmatch.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/fnmatch.rst | 5 | ||||
-rw-r--r-- | Doc/library/glob.rst | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Doc/library/fnmatch.rst b/Doc/library/fnmatch.rst index 4911980..b14c5512 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 @@ -76,8 +79,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 68cc9f0..b881a30 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) |