mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Added maketrans() and optional 3rd arg to translate() (chars to delete).
This commit is contained in:
parent
910a671ba0
commit
f4d0d5784a
2 changed files with 22 additions and 6 deletions
|
@ -123,6 +123,13 @@ negative, \code{len(\var{s})} is added.
|
||||||
Convert letters to lower case.
|
Convert letters to lower case.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
\begin{funcdesc}{maketrans}{from, to}
|
||||||
|
Return a translation table suitable for passing to \code{string.translate}
|
||||||
|
or \code{regex.compile}, that will map each character in \var{from}
|
||||||
|
into the character at the same position in \var{to}; \var{from} and
|
||||||
|
\var{to} must have the same length.
|
||||||
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{split}{s}
|
\begin{funcdesc}{split}{s}
|
||||||
Return a list of the whitespace-delimited words of the string
|
Return a list of the whitespace-delimited words of the string
|
||||||
\var{s}.
|
\var{s}.
|
||||||
|
@ -159,10 +166,11 @@ Remove leading and trailing whitespace from the string
|
||||||
Convert lower case letters to upper case and vice versa.
|
Convert lower case letters to upper case and vice versa.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{translate}{s, table}
|
\begin{funcdesc}{translate}{s, table\optional{, deletechars}}
|
||||||
Translate the characters from \var{s} using \var{table}, which must be
|
Delete all characters from \var{s} that are in \var{deletechars} (if present), and
|
||||||
|
then translate the characters using \var{table}, which must be
|
||||||
a 256-character string giving the translation for each character
|
a 256-character string giving the translation for each character
|
||||||
value, indexed by its ordinal.
|
value, indexed by its ordinal.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{upper}{s}
|
\begin{funcdesc}{upper}{s}
|
||||||
|
|
|
@ -123,6 +123,13 @@ negative, \code{len(\var{s})} is added.
|
||||||
Convert letters to lower case.
|
Convert letters to lower case.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
\begin{funcdesc}{maketrans}{from, to}
|
||||||
|
Return a translation table suitable for passing to \code{string.translate}
|
||||||
|
or \code{regex.compile}, that will map each character in \var{from}
|
||||||
|
into the character at the same position in \var{to}; \var{from} and
|
||||||
|
\var{to} must have the same length.
|
||||||
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{split}{s}
|
\begin{funcdesc}{split}{s}
|
||||||
Return a list of the whitespace-delimited words of the string
|
Return a list of the whitespace-delimited words of the string
|
||||||
\var{s}.
|
\var{s}.
|
||||||
|
@ -159,10 +166,11 @@ Remove leading and trailing whitespace from the string
|
||||||
Convert lower case letters to upper case and vice versa.
|
Convert lower case letters to upper case and vice versa.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{translate}{s, table}
|
\begin{funcdesc}{translate}{s, table\optional{, deletechars}}
|
||||||
Translate the characters from \var{s} using \var{table}, which must be
|
Delete all characters from \var{s} that are in \var{deletechars} (if present), and
|
||||||
|
then translate the characters using \var{table}, which must be
|
||||||
a 256-character string giving the translation for each character
|
a 256-character string giving the translation for each character
|
||||||
value, indexed by its ordinal.
|
value, indexed by its ordinal.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{upper}{s}
|
\begin{funcdesc}{upper}{s}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue