mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Make the text generic, and call it os.path instead of posixpath.
This commit is contained in:
parent
59d8b73cef
commit
b23ee1d899
1 changed files with 24 additions and 27 deletions
|
|
@ -1,16 +1,13 @@
|
||||||
\section{\module{posixpath} ---
|
\section{\module{os.path} ---
|
||||||
Common \POSIX{} pathname manipulations.}
|
Common pathname manipulations}
|
||||||
\declaremodule{standard}{posixpath}
|
\declaremodule{standard}{os.path}
|
||||||
|
|
||||||
\modulesynopsis{Common \POSIX{} pathname manipulations.}
|
\modulesynopsis{Common pathname manipulations.}
|
||||||
|
|
||||||
This module implements some useful functions on \POSIX{} pathnames.
|
|
||||||
|
|
||||||
\strong{Do not import this module directly.} Instead, import the
|
|
||||||
module \module{os}\refstmodindex{os} and use \code{os.path}.
|
|
||||||
|
|
||||||
|
This module implements some useful functions on pathnames.
|
||||||
\index{path!operations}
|
\index{path!operations}
|
||||||
|
|
||||||
|
|
||||||
\begin{funcdesc}{abspath}{p}
|
\begin{funcdesc}{abspath}{p}
|
||||||
Return a normalized absolutized version of the pathname \var{p}. On
|
Return a normalized absolutized version of the pathname \var{p}. On
|
||||||
most platforms, this is equivalent to
|
most platforms, this is equivalent to
|
||||||
|
|
@ -18,24 +15,23 @@ most platforms, this is equivalent to
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{basename}{p}
|
\begin{funcdesc}{basename}{p}
|
||||||
Return the base name of pathname
|
Return the base name of pathname \var{p}. This is the second half of
|
||||||
\var{p}.
|
the pair returned by \code{split(\var{p})}.
|
||||||
This is the second half of the pair returned by
|
|
||||||
\code{posixpath.split(\var{p})}.
|
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{commonprefix}{list}
|
\begin{funcdesc}{commonprefix}{list}
|
||||||
Return the longest string that is a prefix of all strings in
|
Return the longest string that is a prefix of all strings in
|
||||||
\var{list}.
|
\var{list}. If \var{list} is empty, return the empty string
|
||||||
If
|
(\code{''}).
|
||||||
\var{list}
|
\end{funcdesc}
|
||||||
is empty, return the empty string (\code{''}).
|
|
||||||
|
\begin{funcdesc}{dirname}{p}
|
||||||
|
Return the directory name of pathname \var{p}. This is the first half
|
||||||
|
of the pair returned by \code{split(\var{p})}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{exists}{p}
|
\begin{funcdesc}{exists}{p}
|
||||||
Return true if
|
Return true if \var{p} refers to an existing path.
|
||||||
\var{p}
|
|
||||||
refers to an existing path.
|
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{expanduser}{p}
|
\begin{funcdesc}{expanduser}{p}
|
||||||
|
|
@ -44,8 +40,9 @@ Return the argument with an initial component of \samp{\~} or
|
||||||
initial \samp{\~{}} is replaced by the environment variable
|
initial \samp{\~{}} is replaced by the environment variable
|
||||||
\envvar{HOME}; an initial \samp{\~\var{user}} is looked up in the
|
\envvar{HOME}; an initial \samp{\~\var{user}} is looked up in the
|
||||||
password directory through the built-in module
|
password directory through the built-in module
|
||||||
\module{pwd}\refbimodindex{pwd}. If the expansion fails, or if the
|
\refmodule{pwd}\refbimodindex{pwd}. If the expansion fails, or if the
|
||||||
path does not begin with a tilde, the path is returned unchanged.
|
path does not begin with a tilde, the path is returned unchanged. On
|
||||||
|
the Macintosh, this always returns \var{p} unchanged.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{expandvars}{p}
|
\begin{funcdesc}{expandvars}{p}
|
||||||
|
|
@ -53,7 +50,7 @@ Return the argument with environment variables expanded. Substrings
|
||||||
of the form \samp{\$\var{name}} or \samp{\$\{\var{name}\}} are
|
of the form \samp{\$\var{name}} or \samp{\$\{\var{name}\}} are
|
||||||
replaced by the value of environment variable \var{name}. Malformed
|
replaced by the value of environment variable \var{name}. Malformed
|
||||||
variable names and references to non-existing variables are left
|
variable names and references to non-existing variables are left
|
||||||
unchanged.
|
unchanged. On the Macintosh, this always returns \var{p} unchanged.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{getsize}{filename}
|
\begin{funcdesc}{getsize}{filename}
|
||||||
|
|
@ -66,16 +63,16 @@ Return the size, in bytes, of \var{filename}. Raise
|
||||||
\versionadded{1.5.2}
|
\versionadded{1.5.2}
|
||||||
Return the time of last modification of \var{filename}. The return
|
Return the time of last modification of \var{filename}. The return
|
||||||
value is integer giving the number of seconds since the epoch (see the
|
value is integer giving the number of seconds since the epoch (see the
|
||||||
\module{time} module. Raise \exception{os.error} if the file does not
|
\refmodule{time} module). Raise \exception{os.error} if the file does
|
||||||
exist or is inaccessible.
|
not exist or is inaccessible.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{getatime}{filename}
|
\begin{funcdesc}{getatime}{filename}
|
||||||
\versionadded{1.5.2}
|
\versionadded{1.5.2}
|
||||||
Return the time of last access of \var{filename}. The return
|
Return the time of last access of \var{filename}. The return
|
||||||
value is integer giving the number of seconds since the epoch (see the
|
value is integer giving the number of seconds since the epoch (see the
|
||||||
\module{time} module. Raise \exception{os.error} if the file does not
|
\refmodule{time} module). Raise \exception{os.error} if the file does
|
||||||
exist or is inaccessible.
|
not exist or is inaccessible.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{isabs}{p}
|
\begin{funcdesc}{isabs}{p}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue