Standard Module posixpath

posixpath

This module implements some useful functions on POSIX pathnames.

Do not import this module directly. Instead, import the module os and use os.path. os


\begin{funcdesc}{basename}{p}
Return the base name of pathname
\var{p}.
This is ...
...ond half of the pair returned by
\code{posixpath.split(\var{p})}.
\end{funcdesc}


\begin{funcdesc}{commonprefix}{list}
Return the longest string that is a prefix ...
...st}.
If
\var{list}
is empty, return the empty string (\code{''}).
\end{funcdesc}


\begin{funcdesc}{exists}{p}
Return true if
\var{p}
refers to an existing path.
\end{funcdesc}


\begin{funcdesc}{expanduser}{p}
Return the argument with an initial component of...
...path does not begin with a tilde, the path is returned unchanged.
\end{funcdesc}


\begin{funcdesc}{expandvars}{p}
Return the argument with environment variables e...
...ames and references to non-existing variables are left
unchanged.
\end{funcdesc}


\begin{funcdesc}{isabs}{p}
Return true if \var{p} is an absolute pathname (begins with a slash).
\end{funcdesc}


\begin{funcdesc}{isfile}{p}
Return true if \var{p} is an existing regular file. ...
...code{islink()} and \code{isfile()} can be true for the same
path.
\end{funcdesc}


\begin{funcdesc}{isdir}{p}
Return true if \var{p} is an existing directory. This...
...\code{islink()} and \code{isdir()} can be true for the same
path.
\end{funcdesc}


\begin{funcdesc}{islink}{p}
Return true if
\var{p}
refers to a directory entry t...
... symbolic link.
Always false if symbolic links are not supported.
\end{funcdesc}


\begin{funcdesc}{ismount}{p}
Return true if pathname \var{p} is a \dfn{mount poi...
...is should
detect mount points for all \UNIX{} and POSIX variants.
\end{funcdesc}


\begin{funcdesc}{join}{p\, q}
Join the paths
\var{p}
and
\var{q} intelligently:
...
...(\code{'/'}) inserted unless
\var{p}
is empty or ends in a slash.
\end{funcdesc}


\begin{funcdesc}{normcase}{p}
Normalize the case of a pathname. This returns the...
...lar function in \code{macpath} converts upper case to
lower case.
\end{funcdesc}


\begin{funcdesc}{samefile}{p\, q}
Return true if both pathname arguments refer t...
...ber).
Raise an exception if a stat call on either pathname fails.
\end{funcdesc}


\begin{funcdesc}{split}{p}
Split the pathname \var{p} in a pair \code{(\var{head...
...ere were multiple
slashes separating \var{head} from \var{tail}).
\end{funcdesc}


\begin{funcdesc}{splitext}{p}
Split the pathname \var{p} in a pair \code{(\var{r...
...is empty or begins with a period and contains
at most one period.
\end{funcdesc}


\begin{funcdesc}{walk}{p\, visit\, arg}
Calls the function \var{visit} with argu...
...must be modified in place, using \code{del} or slice
assignment.)
\end{funcdesc}