Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8b1c47b

Browse files
committed
Document the optional argument to the .strip(), .rstrip(), .strip() string
methods. Part of SF feature #444708.
1 parent 4904204 commit 8b1c47b

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

Doc/lib/libstdtypes.tex

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,12 @@ \subsubsection{String Methods \label{string-methods}}
603603
Return a copy of the string converted to lowercase.
604604
\end{methoddesc}
605605

606-
\begin{methoddesc}[string]{lstrip}{}
607-
Return a copy of the string with leading whitespace removed.
606+
\begin{methoddesc}[string]{lstrip}{\optional{chars}}
607+
Return a copy of the string with leading characters removed. If
608+
\var{chars} is omitted or \code{None}, whitespace characters are
609+
removed. If given and not \code{None}, \var{chars} must be a string;
610+
the characters in the string will be stripped from the beginning of
611+
the string this method is called on.
608612
\end{methoddesc}
609613

610614
\begin{methoddesc}[string]{replace}{old, new\optional{, maxsplit}}
@@ -632,8 +636,12 @@ \subsubsection{String Methods \label{string-methods}}
632636
\var{width} is less than \code{len(\var{s})}.
633637
\end{methoddesc}
634638

635-
\begin{methoddesc}[string]{rstrip}{}
636-
Return a copy of the string with trailing whitespace removed.
639+
\begin{methoddesc}[string]{rstrip}{\optional{chars}}
640+
Return a copy of the string with trailing characters removed. If
641+
\var{chars} is omitted or \code{None}, whitespace characters are
642+
removed. If given and not \code{None}, \var{chars} must be a string;
643+
the characters in the string will be stripped from the end of the
644+
string this method is called on.
637645
\end{methoddesc}
638646

639647
\begin{methoddesc}[string]{split}{\optional{sep \optional{,maxsplit}}}
@@ -649,16 +657,20 @@ \subsubsection{String Methods \label{string-methods}}
649657
\var{keepends} is given and true.
650658
\end{methoddesc}
651659

652-
\begin{methoddesc}[string]{startswith}{prefix\optional{, start\optional{, end}}}
660+
\begin{methoddesc}[string]{startswith}{prefix\optional{,
661+
start\optional{, end}}}
653662
Return true if string starts with the \var{prefix}, otherwise
654663
return false. With optional \var{start}, test string beginning at
655664
that position. With optional \var{end}, stop comparing string at that
656665
position.
657666
\end{methoddesc}
658667

659-
\begin{methoddesc}[string]{strip}{}
660-
Return a copy of the string with leading and trailing whitespace
661-
removed.
668+
\begin{methoddesc}[string]{strip}{\optional{chars}}
669+
Return a copy of the string with leading and trailing characters
670+
removed. If \var{chars} is omitted or \code{None}, whitespace
671+
characters are removed. If given and not \code{None}, \var{chars}
672+
must be a string; the characters in the string will be stripped from
673+
the both ends of the string this method is called on.
662674
\end{methoddesc}
663675

664676
\begin{methoddesc}[string]{swapcase}{}

0 commit comments

Comments
 (0)