diff options
| author | Hye-Shik Chang <hyeshik@gmail.com> | 2003-12-15 18:49:53 +0000 | 
|---|---|---|
| committer | Hye-Shik Chang <hyeshik@gmail.com> | 2003-12-15 18:49:53 +0000 | 
| commit | 3ae811b57d227a220f207869487fd9251e278608 (patch) | |
| tree | ccbc4b81578fa69e6bc65df8da4994bf9a4b6e49 /Doc/lib | |
| parent | dce391cb398f4ce266d98130d10810a6a36617b3 (diff) | |
| download | cpython-git-3ae811b57d227a220f207869487fd9251e278608.tar.gz | |
Add rsplit method for str and unicode builtin types.
SF feature request #801847.
Original patch is written by Sean Reifschneider.
Diffstat (limited to 'Doc/lib')
| -rw-r--r-- | Doc/lib/libstdtypes.tex | 18 | ||||
| -rw-r--r-- | Doc/lib/libstring.tex | 17 | 
2 files changed, 35 insertions, 0 deletions
| diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex index 7feda60473..4ce6ec5dd3 100644 --- a/Doc/lib/libstdtypes.tex +++ b/Doc/lib/libstdtypes.tex @@ -694,6 +694,24 @@ The original string is returned if  \versionchanged[Support for the \var{fillchar} argument]{2.4}  \end{methoddesc} +\begin{methoddesc}[string]{rsplit}{\optional{, sep\optional{, maxsplit}}} +Return a list of the words of the string, scanning the string from +the end working forward.  The resulting list of words is in the +same order as \function{split()}.  If the optional second argument +\var{sep} is absent or \code{None}, the words are separated by +arbitrary strings of whitespace characters (space, tab, newline, +return, formfeed).  If the second argument \var{sep} is present and +not \code{None}, it specifies a string to be used as the word +separator.  The returned list will then have one more item than the +number of non-overlapping occurrences of the separator in the string. +The optional third argument \var{maxsplit} defaults to 0.  If it +is nonzero, at most \var{maxsplit} number of splits occur, and the +remainder of the string is returned as the first element of the +list (thus, the list will have at most \code{\var{maxsplit}+1} +elements). +\versionadded{2.4} +\end{methoddesc} +  \begin{methoddesc}[string]{rstrip}{\optional{chars}}  Return a copy of the string with trailing characters removed.  If  \var{chars} is omitted or \code{None}, whitespace characters are diff --git a/Doc/lib/libstring.tex b/Doc/lib/libstring.tex index 3f902cf840..11054e2614 100644 --- a/Doc/lib/libstring.tex +++ b/Doc/lib/libstring.tex @@ -215,6 +215,23 @@ The functions defined in this module are:    elements).  \end{funcdesc} +\begin{funcdesc}{rsplit}{s\optional{, sep\optional{, maxsplit}}} +  Return a list of the words of the string \var{s}, scanning \var{s} from +  the end working forward.  The resulting list of words is in the same +  order as \function{split()}.  If the optional second argument \var{sep} +  is absent or \code{None}, the words are separated by arbitrary strings +  of whitespace characters (space, tab, newline, return, formfeed). +  If the second argument \var{sep} is present and not \code{None}, it +  specifies a string to be used as the word separator.  The returned +  list will then have one more item than the number of non-overlapping +  occurrences of the separator in the string.  The optional third argument +  \var{maxsplit} defaults to 0.  If it is nonzero, at most \var{maxsplit} +  number of splits occur, and the remainder of the string is returned +  as the first element of the list (thus, the list will have at most +  \code{\var{maxsplit}+1} elements). +  \versionadded{2.4} +\end{funcdesc} +  \begin{funcdesc}{splitfields}{s\optional{, sep\optional{, maxsplit}}}    This function behaves identically to \function{split()}.  (In the    past, \function{split()} was only used with one argument, while | 
