Kaydet (Commit) 5447850f authored tarafından Georg Brandl's avatar Georg Brandl

Fix the class name of strings.

üst 5f4c5807
...@@ -572,25 +572,25 @@ linear concatenation performance across versions and implementations. ...@@ -572,25 +572,25 @@ linear concatenation performance across versions and implementations.
These are the string methods which both 8-bit strings and Unicode These are the string methods which both 8-bit strings and Unicode
objects support: objects support:
\begin{methoddesc}[string]{capitalize}{} \begin{methoddesc}[str]{capitalize}{}
Return a copy of the string with only its first character capitalized. Return a copy of the string with only its first character capitalized.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{center}{width\optional{, fillchar}} \begin{methoddesc}[str]{center}{width\optional{, fillchar}}
Return centered in a string of length \var{width}. Padding is done Return centered in a string of length \var{width}. Padding is done
using the specified \var{fillchar} (default is a space). using the specified \var{fillchar} (default is a space).
\versionchanged[Support for the \var{fillchar} argument]{2.4} \versionchanged[Support for the \var{fillchar} argument]{2.4}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{count}{sub\optional{, start\optional{, end}}} \begin{methoddesc}[str]{count}{sub\optional{, start\optional{, end}}}
Return the number of occurrences of substring \var{sub} in string Return the number of occurrences of substring \var{sub} in string
S\code{[\var{start}:\var{end}]}. Optional arguments \var{start} and S\code{[\var{start}:\var{end}]}. Optional arguments \var{start} and
\var{end} are interpreted as in slice notation. \var{end} are interpreted as in slice notation.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{decode}{\optional{encoding\optional{, errors}}} \begin{methoddesc}[str]{decode}{\optional{encoding\optional{, errors}}}
Decodes the string using the codec registered for \var{encoding}. Decodes the string using the codec registered for \var{encoding}.
\var{encoding} defaults to the default string encoding. \var{errors} \var{encoding} defaults to the default string encoding. \var{errors}
may be given to set a different error handling scheme. The default is may be given to set a different error handling scheme. The default is
...@@ -602,7 +602,7 @@ may be given to set a different error handling scheme. The default is ...@@ -602,7 +602,7 @@ may be given to set a different error handling scheme. The default is
\versionchanged[Support for other error handling schemes added]{2.3} \versionchanged[Support for other error handling schemes added]{2.3}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{encode}{\optional{encoding\optional{,errors}}} \begin{methoddesc}[str]{encode}{\optional{encoding\optional{,errors}}}
Return an encoded version of the string. Default encoding is the current Return an encoded version of the string. Default encoding is the current
default string encoding. \var{errors} may be given to set a different default string encoding. \var{errors} may be given to set a different
error handling scheme. The default for \var{errors} is error handling scheme. The default for \var{errors} is
...@@ -617,7 +617,7 @@ For a list of possible encodings, see section~\ref{standard-encodings}. ...@@ -617,7 +617,7 @@ For a list of possible encodings, see section~\ref{standard-encodings}.
\code{'backslashreplace'} and other error handling schemes added]{2.3} \code{'backslashreplace'} and other error handling schemes added]{2.3}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{endswith}{suffix\optional{, start\optional{, end}}} \begin{methoddesc}[str]{endswith}{suffix\optional{, start\optional{, end}}}
Return \code{True} if the string ends with the specified \var{suffix}, Return \code{True} if the string ends with the specified \var{suffix},
otherwise return \code{False}. \var{suffix} can also be a tuple of otherwise return \code{False}. \var{suffix} can also be a tuple of
suffixes to look for. With optional \var{start}, test beginning at suffixes to look for. With optional \var{start}, test beginning at
...@@ -626,13 +626,13 @@ that position. With optional \var{end}, stop comparing at that position. ...@@ -626,13 +626,13 @@ that position. With optional \var{end}, stop comparing at that position.
\versionchanged[Accept tuples as \var{suffix}]{2.5} \versionchanged[Accept tuples as \var{suffix}]{2.5}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{expandtabs}{\optional{tabsize}} \begin{methoddesc}[str]{expandtabs}{\optional{tabsize}}
Return a copy of the string where all tab characters are expanded Return a copy of the string where all tab characters are expanded
using spaces. If \var{tabsize} is not given, a tab size of \code{8} using spaces. If \var{tabsize} is not given, a tab size of \code{8}
characters is assumed. characters is assumed.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{find}{sub\optional{, start\optional{, end}}} \begin{methoddesc}[str]{find}{sub\optional{, start\optional{, end}}}
Return the lowest index in the string where substring \var{sub} is Return the lowest index in the string where substring \var{sub} is
found, such that \var{sub} is contained in the range [\var{start}, found, such that \var{sub} is contained in the range [\var{start},
\var{end}]. Optional arguments \var{start} and \var{end} are \var{end}]. Optional arguments \var{start} and \var{end} are
...@@ -640,47 +640,47 @@ interpreted as in slice notation. Return \code{-1} if \var{sub} is ...@@ -640,47 +640,47 @@ interpreted as in slice notation. Return \code{-1} if \var{sub} is
not found. not found.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{index}{sub\optional{, start\optional{, end}}} \begin{methoddesc}[str]{index}{sub\optional{, start\optional{, end}}}
Like \method{find()}, but raise \exception{ValueError} when the Like \method{find()}, but raise \exception{ValueError} when the
substring is not found. substring is not found.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{isalnum}{} \begin{methoddesc}[str]{isalnum}{}
Return true if all characters in the string are alphanumeric and there Return true if all characters in the string are alphanumeric and there
is at least one character, false otherwise. is at least one character, false otherwise.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{isalpha}{} \begin{methoddesc}[str]{isalpha}{}
Return true if all characters in the string are alphabetic and there Return true if all characters in the string are alphabetic and there
is at least one character, false otherwise. is at least one character, false otherwise.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{isdigit}{} \begin{methoddesc}[str]{isdigit}{}
Return true if all characters in the string are digits and there Return true if all characters in the string are digits and there
is at least one character, false otherwise. is at least one character, false otherwise.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{islower}{} \begin{methoddesc}[str]{islower}{}
Return true if all cased characters in the string are lowercase and Return true if all cased characters in the string are lowercase and
there is at least one cased character, false otherwise. there is at least one cased character, false otherwise.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{isspace}{} \begin{methoddesc}[str]{isspace}{}
Return true if there are only whitespace characters in the string and Return true if there are only whitespace characters in the string and
there is at least one character, false otherwise. there is at least one character, false otherwise.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{istitle}{} \begin{methoddesc}[str]{istitle}{}
Return true if the string is a titlecased string and there is at least one Return true if the string is a titlecased string and there is at least one
character, for example uppercase characters may only follow uncased character, for example uppercase characters may only follow uncased
characters and lowercase characters only cased ones. Return false characters and lowercase characters only cased ones. Return false
...@@ -689,20 +689,20 @@ otherwise. ...@@ -689,20 +689,20 @@ otherwise.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{isupper}{} \begin{methoddesc}[str]{isupper}{}
Return true if all cased characters in the string are uppercase and Return true if all cased characters in the string are uppercase and
there is at least one cased character, false otherwise. there is at least one cased character, false otherwise.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{join}{seq} \begin{methoddesc}[str]{join}{seq}
Return a string which is the concatenation of the strings in the Return a string which is the concatenation of the strings in the
sequence \var{seq}. The separator between elements is the string sequence \var{seq}. The separator between elements is the string
providing this method. providing this method.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{ljust}{width\optional{, fillchar}} \begin{methoddesc}[str]{ljust}{width\optional{, fillchar}}
Return the string left justified in a string of length \var{width}. Return the string left justified in a string of length \var{width}.
Padding is done using the specified \var{fillchar} (default is a Padding is done using the specified \var{fillchar} (default is a
space). The original string is returned if space). The original string is returned if
...@@ -710,13 +710,13 @@ space). The original string is returned if ...@@ -710,13 +710,13 @@ space). The original string is returned if
\versionchanged[Support for the \var{fillchar} argument]{2.4} \versionchanged[Support for the \var{fillchar} argument]{2.4}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{lower}{} \begin{methoddesc}[str]{lower}{}
Return a copy of the string converted to lowercase. Return a copy of the string converted to lowercase.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{lstrip}{\optional{chars}} \begin{methoddesc}[str]{lstrip}{\optional{chars}}
Return a copy of the string with leading characters removed. The Return a copy of the string with leading characters removed. The
\var{chars} argument is a string specifying the set of characters \var{chars} argument is a string specifying the set of characters
to be removed. If omitted or \code{None}, the \var{chars} argument to be removed. If omitted or \code{None}, the \var{chars} argument
...@@ -731,7 +731,7 @@ a prefix; rather, all combinations of its values are stripped: ...@@ -731,7 +731,7 @@ a prefix; rather, all combinations of its values are stripped:
\versionchanged[Support for the \var{chars} argument]{2.2.2} \versionchanged[Support for the \var{chars} argument]{2.2.2}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{partition}{sep} \begin{methoddesc}[str]{partition}{sep}
Split the string at the first occurrence of \var{sep}, and return Split the string at the first occurrence of \var{sep}, and return
a 3-tuple containing the part before the separator, the separator a 3-tuple containing the part before the separator, the separator
itself, and the part after the separator. If the separator is not itself, and the part after the separator. If the separator is not
...@@ -740,26 +740,26 @@ two empty strings. ...@@ -740,26 +740,26 @@ two empty strings.
\versionadded{2.5} \versionadded{2.5}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{replace}{old, new\optional{, count}} \begin{methoddesc}[str]{replace}{old, new\optional{, count}}
Return a copy of the string with all occurrences of substring Return a copy of the string with all occurrences of substring
\var{old} replaced by \var{new}. If the optional argument \var{old} replaced by \var{new}. If the optional argument
\var{count} is given, only the first \var{count} occurrences are \var{count} is given, only the first \var{count} occurrences are
replaced. replaced.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{rfind}{sub \optional{,start \optional{,end}}} \begin{methoddesc}[str]{rfind}{sub \optional{,start \optional{,end}}}
Return the highest index in the string where substring \var{sub} is Return the highest index in the string where substring \var{sub} is
found, such that \var{sub} is contained within s[start,end]. Optional found, such that \var{sub} is contained within s[start,end]. Optional
arguments \var{start} and \var{end} are interpreted as in slice arguments \var{start} and \var{end} are interpreted as in slice
notation. Return \code{-1} on failure. notation. Return \code{-1} on failure.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{rindex}{sub\optional{, start\optional{, end}}} \begin{methoddesc}[str]{rindex}{sub\optional{, start\optional{, end}}}
Like \method{rfind()} but raises \exception{ValueError} when the Like \method{rfind()} but raises \exception{ValueError} when the
substring \var{sub} is not found. substring \var{sub} is not found.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{rjust}{width\optional{, fillchar}} \begin{methoddesc}[str]{rjust}{width\optional{, fillchar}}
Return the string right justified in a string of length \var{width}. Return the string right justified in a string of length \var{width}.
Padding is done using the specified \var{fillchar} (default is a space). Padding is done using the specified \var{fillchar} (default is a space).
The original string is returned if The original string is returned if
...@@ -767,7 +767,7 @@ The original string is returned if ...@@ -767,7 +767,7 @@ The original string is returned if
\versionchanged[Support for the \var{fillchar} argument]{2.4} \versionchanged[Support for the \var{fillchar} argument]{2.4}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{rpartition}{sep} \begin{methoddesc}[str]{rpartition}{sep}
Split the string at the last occurrence of \var{sep}, and return Split the string at the last occurrence of \var{sep}, and return
a 3-tuple containing the part before the separator, the separator a 3-tuple containing the part before the separator, the separator
itself, and the part after the separator. If the separator is not itself, and the part after the separator. If the separator is not
...@@ -776,7 +776,7 @@ the string itself. ...@@ -776,7 +776,7 @@ the string itself.
\versionadded{2.5} \versionadded{2.5}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{rsplit}{\optional{sep \optional{,maxsplit}}} \begin{methoddesc}[str]{rsplit}{\optional{sep \optional{,maxsplit}}}
Return a list of the words in the string, using \var{sep} as the Return a list of the words in the string, using \var{sep} as the
delimiter string. If \var{maxsplit} is given, at most \var{maxsplit} delimiter string. If \var{maxsplit} is given, at most \var{maxsplit}
splits are done, the \emph{rightmost} ones. If \var{sep} is not specified splits are done, the \emph{rightmost} ones. If \var{sep} is not specified
...@@ -786,7 +786,7 @@ is described in detail below. ...@@ -786,7 +786,7 @@ is described in detail below.
\versionadded{2.4} \versionadded{2.4}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{rstrip}{\optional{chars}} \begin{methoddesc}[str]{rstrip}{\optional{chars}}
Return a copy of the string with trailing characters removed. The Return a copy of the string with trailing characters removed. The
\var{chars} argument is a string specifying the set of characters \var{chars} argument is a string specifying the set of characters
to be removed. If omitted or \code{None}, the \var{chars} argument to be removed. If omitted or \code{None}, the \var{chars} argument
...@@ -801,7 +801,7 @@ a suffix; rather, all combinations of its values are stripped: ...@@ -801,7 +801,7 @@ a suffix; rather, all combinations of its values are stripped:
\versionchanged[Support for the \var{chars} argument]{2.2.2} \versionchanged[Support for the \var{chars} argument]{2.2.2}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{split}{\optional{sep \optional{,maxsplit}}} \begin{methoddesc}[str]{split}{\optional{sep \optional{,maxsplit}}}
Return a list of the words in the string, using \var{sep} as the Return a list of the words in the string, using \var{sep} as the
delimiter string. If \var{maxsplit} is given, at most \var{maxsplit} delimiter string. If \var{maxsplit} is given, at most \var{maxsplit}
splits are done. (thus, the list will have at most \code{\var{maxsplit}+1} splits are done. (thus, the list will have at most \code{\var{maxsplit}+1}
...@@ -824,13 +824,13 @@ Splitting an empty string or a string consisting of just whitespace ...@@ -824,13 +824,13 @@ Splitting an empty string or a string consisting of just whitespace
returns an empty list. returns an empty list.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{splitlines}{\optional{keepends}} \begin{methoddesc}[str]{splitlines}{\optional{keepends}}
Return a list of the lines in the string, breaking at line Return a list of the lines in the string, breaking at line
boundaries. Line breaks are not included in the resulting list unless boundaries. Line breaks are not included in the resulting list unless
\var{keepends} is given and true. \var{keepends} is given and true.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{startswith}{prefix\optional{, \begin{methoddesc}[str]{startswith}{prefix\optional{,
start\optional{, end}}} start\optional{, end}}}
Return \code{True} if string starts with the \var{prefix}, otherwise Return \code{True} if string starts with the \var{prefix}, otherwise
return \code{False}. \var{prefix} can also be a tuple of return \code{False}. \var{prefix} can also be a tuple of
...@@ -841,7 +841,7 @@ position. ...@@ -841,7 +841,7 @@ position.
\versionchanged[Accept tuples as \var{prefix}]{2.5} \versionchanged[Accept tuples as \var{prefix}]{2.5}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{strip}{\optional{chars}} \begin{methoddesc}[str]{strip}{\optional{chars}}
Return a copy of the string with the leading and trailing characters Return a copy of the string with the leading and trailing characters
removed. The \var{chars} argument is a string specifying the set of removed. The \var{chars} argument is a string specifying the set of
characters to be removed. If omitted or \code{None}, the \var{chars} characters to be removed. If omitted or \code{None}, the \var{chars}
...@@ -856,21 +856,21 @@ a prefix or suffix; rather, all combinations of its values are stripped: ...@@ -856,21 +856,21 @@ a prefix or suffix; rather, all combinations of its values are stripped:
\versionchanged[Support for the \var{chars} argument]{2.2.2} \versionchanged[Support for the \var{chars} argument]{2.2.2}
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{swapcase}{} \begin{methoddesc}[str]{swapcase}{}
Return a copy of the string with uppercase characters converted to Return a copy of the string with uppercase characters converted to
lowercase and vice versa. lowercase and vice versa.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{title}{} \begin{methoddesc}[str]{title}{}
Return a titlecased version of the string: words start with uppercase Return a titlecased version of the string: words start with uppercase
characters, all remaining cased characters are lowercase. characters, all remaining cased characters are lowercase.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{translate}{table\optional{, deletechars}} \begin{methoddesc}[str]{translate}{table\optional{, deletechars}}
Return a copy of the string where all characters occurring in the Return a copy of the string where all characters occurring in the
optional argument \var{deletechars} are removed, and the remaining optional argument \var{deletechars} are removed, and the remaining
characters have been mapped through the given translation table, which characters have been mapped through the given translation table, which
...@@ -890,13 +890,13 @@ character mapping codec using the \refmodule{codecs} module (see ...@@ -890,13 +890,13 @@ character mapping codec using the \refmodule{codecs} module (see
\module{encodings.cp1251} for an example). \module{encodings.cp1251} for an example).
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{upper}{} \begin{methoddesc}[str]{upper}{}
Return a copy of the string converted to uppercase. Return a copy of the string converted to uppercase.
For 8-bit strings, this method is locale-dependent. For 8-bit strings, this method is locale-dependent.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{zfill}{width} \begin{methoddesc}[str]{zfill}{width}
Return the numeric string left filled with zeros in a string Return the numeric string left filled with zeros in a string
of length \var{width}. The original string is returned if of length \var{width}. The original string is returned if
\var{width} is less than \code{len(\var{s})}. \var{width} is less than \code{len(\var{s})}.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment