Skip to content

Commit ae431aa

Browse files
committed
gh-106318: Add doctest role for str.strip() method
1 parent 869cdd2 commit ae431aa

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Doc/library/stdtypes.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,7 +2777,11 @@ expression support in the :mod:`re` module).
27772777
The *chars* argument is a string specifying the set of characters to be removed.
27782778
If omitted or ``None``, the *chars* argument defaults to removing whitespace.
27792779
The *chars* argument is not a prefix or suffix; rather, all combinations of its
2780-
values are stripped::
2780+
values are stripped.
2781+
2782+
For example:
2783+
2784+
.. doctest::
27812785

27822786
>>> ' spacious '.strip()
27832787
'spacious'
@@ -2788,7 +2792,10 @@ expression support in the :mod:`re` module).
27882792
from the string. Characters are removed from the leading end until
27892793
reaching a string character that is not contained in the set of
27902794
characters in *chars*. A similar action takes place on the trailing end.
2791-
For example::
2795+
2796+
For example:
2797+
2798+
.. doctest::
27922799

27932800
>>> comment_string = '#....... Section 3.2.1 Issue #32 .......'
27942801
>>> comment_string.strip('.#! ')

0 commit comments

Comments
 (0)