#16420: document a way to escape metacharacters in glob/fnmatch.
This commit is contained in:
parent
820f2bdaf9
commit
1df43d33d2
Doc/library
|
@ -29,6 +29,9 @@ special characters used in shell-style wildcards are:
|
||||||
| ``[!seq]`` | matches any character not in *seq* |
|
| ``[!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
|
.. index:: module: glob
|
||||||
|
|
||||||
Note that the filename separator (``'/'`` on Unix) is *not* special to this
|
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.
|
Return the shell-style *pattern* converted to a regular expression.
|
||||||
|
|
||||||
Be aware there is no way to quote meta-characters.
|
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
>>> import fnmatch, re
|
>>> import fnmatch, re
|
||||||
|
|
|
@ -19,6 +19,9 @@ matched. This is done by using the :func:`os.listdir` and
|
||||||
subshell. (For tilde and shell variable expansion, use
|
subshell. (For tilde and shell variable expansion, use
|
||||||
:func:`os.path.expanduser` and :func:`os.path.expandvars`.)
|
: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)
|
.. function:: glob(pathname)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue