mirror of https://github.com/python/cpython
Fixed minor nits, added index entries to make these easier to find for people
not familiar with Unix terminology.
This commit is contained in:
parent
c43e6a2f31
commit
8d2c0c2ab4
|
@ -1,14 +1,15 @@
|
||||||
\section{\module{fnmatch} ---
|
\section{\module{fnmatch} ---
|
||||||
\UNIX{} shell style pathname pattern matching.}
|
\UNIX{} style filename pattern matching}
|
||||||
\declaremodule{standard}{fnmatch}
|
|
||||||
|
|
||||||
\modulesynopsis{\UNIX{} shell style pathname pattern matching.}
|
\declaremodule{standard}{fnmatch}
|
||||||
|
\modulesynopsis{\UNIX{} shell style filename pattern matching.}
|
||||||
|
|
||||||
|
|
||||||
This module provides support for \UNIX{} shell-style wildcards, which
|
This module provides support for \UNIX{} shell-style wildcards, which
|
||||||
are \emph{not} the same as regular expressions (which are documented
|
are \emph{not} the same as regular expressions (which are documented
|
||||||
in the \module{re}\refstmodindex{re} module). The special characters
|
in the \refmodule{re}\refstmodindex{re} module). The special
|
||||||
used in shell-style wildcards are:
|
characters used in shell-style wildcards are:
|
||||||
|
\index{filenames!wildcard expansion}
|
||||||
|
|
||||||
\begin{list}{}{\leftmargin 0.5in \labelwidth 0.45in}
|
\begin{list}{}{\leftmargin 0.5in \labelwidth 0.45in}
|
||||||
\item[\code{*}] matches everything
|
\item[\code{*}] matches everything
|
||||||
|
@ -38,6 +39,7 @@ Test whether \var{filename} matches \var{pattern}, returning true or
|
||||||
false; the comparision is case-sensitive.
|
false; the comparision is case-sensitive.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
||||||
\begin{seealso}
|
\begin{seealso}
|
||||||
\seemodule{glob}{Shell-style path expansion}
|
\seemodule{glob}{Shell-style path expansion}
|
||||||
\end{seealso}
|
\end{seealso}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
\section{\module{glob} ---
|
\section{\module{glob} ---
|
||||||
\UNIX{} shell style pathname pattern expansion.}
|
\UNIX{} style pathname pattern expansion}
|
||||||
\declaremodule{standard}{glob}
|
|
||||||
|
|
||||||
|
\declaremodule{standard}{glob}
|
||||||
\modulesynopsis{\UNIX{} shell style pathname pattern expansion.}
|
\modulesynopsis{\UNIX{} shell style pathname pattern expansion.}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,13 +13,14 @@ using the \function{os.listdir()} and \function{fnmatch.fnmatch()}
|
||||||
functions in concert, and not by actually invoking a subshell. (For
|
functions in concert, and not by actually invoking a subshell. (For
|
||||||
tilde and shell variable expansion, use \function{os.path.expanduser()}
|
tilde and shell variable expansion, use \function{os.path.expanduser()}
|
||||||
and \function{os.path.expandvars()}.)
|
and \function{os.path.expandvars()}.)
|
||||||
|
\index{filenames!pathname expansion}
|
||||||
|
|
||||||
\begin{funcdesc}{glob}{pathname}
|
\begin{funcdesc}{glob}{pathname}
|
||||||
Returns a possibly-empty list of path names that match \var{pathname},
|
Returns a possibly-empty list of path names that match \var{pathname},
|
||||||
which must be a string containing a path specification.
|
which must be a string containing a path specification.
|
||||||
\var{pathname} can be either absolute (like
|
\var{pathname} can be either absolute (like
|
||||||
\file{/usr/src/Python-1.5/Makefile}) or relative (like
|
\file{/usr/src/Python-1.5/Makefile}) or relative (like
|
||||||
\file{../../Tools/*.gif}), and can contain shell-style wildcards.
|
\file{../../Tools/*/*.gif}), and can contain shell-style wildcards.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
For example, consider a directory containing only the following files:
|
For example, consider a directory containing only the following files:
|
||||||
|
@ -36,3 +37,8 @@ of the path are preserved.
|
||||||
>>> glob.glob('?.gif')
|
>>> glob.glob('?.gif')
|
||||||
['1.gif']
|
['1.gif']
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
|
|
||||||
|
\begin{seealso}
|
||||||
|
\seemodule{fnmatch}{Shell-style filename (not path) expansion}
|
||||||
|
\end{seealso}
|
||||||
|
|
Loading…
Reference in New Issue