@@ -2389,21 +2389,27 @@ expression support in the :mod:`re` module).
23892389 Return a copy of the string with trailing characters removed. The *chars *
23902390 argument is a string specifying the set of characters to be removed. If omitted
23912391 or ``None ``, the *chars * argument defaults to removing whitespace. The *chars *
2392- argument is not a suffix; rather, all combinations of its values are stripped::
2392+ argument is not a suffix; rather, all combinations of its values are stripped.
2393+ For example:
2394+
2395+ .. doctest ::
23932396
23942397 >>> ' spacious ' .rstrip()
23952398 ' spacious'
23962399 >>> ' mississippi' .rstrip(' ipz' )
23972400 'mississ'
23982401
2399- See :meth: `str. removesuffix ` for a method that will remove a single suffix
2402+ See :meth: `removesuffix ` for a method that will remove a single suffix
24002403 string rather than all of a set of characters. For example::
24012404
24022405 >>> 'Monty Python'.rstrip(' Python')
24032406 'M'
24042407 >>> 'Monty Python'.removesuffix(' Python')
24052408 'Monty'
24062409
2410+ See also :meth: `strip `.
2411+
2412+
24072413.. method :: str.split(sep=None, maxsplit=-1)
24082414
24092415 Return a list of the words in the string, using *sep * as the delimiter
@@ -2554,7 +2560,11 @@ expression support in the :mod:`re` module).
25542560 The *chars * argument is a string specifying the set of characters to be removed.
25552561 If omitted or ``None ``, the *chars * argument defaults to removing whitespace.
25562562 The *chars * argument is not a prefix or suffix; rather, all combinations of its
2557- values are stripped::
2563+ values are stripped.
2564+
2565+ For example:
2566+
2567+ .. doctest ::
25582568
25592569 >>> ' spacious ' .strip()
25602570 'spacious'
@@ -2565,12 +2575,17 @@ expression support in the :mod:`re` module).
25652575 from the string. Characters are removed from the leading end until
25662576 reaching a string character that is not contained in the set of
25672577 characters in *chars *. A similar action takes place on the trailing end.
2568- For example::
2578+
2579+ For example:
2580+
2581+ .. doctest ::
25692582
25702583 >>> comment_string = ' #....... Section 3.2.1 Issue #32 .......'
25712584 >>> comment_string.strip(' .#! ' )
25722585 'Section 3.2.1 Issue #32'
25732586
2587+ See also :meth: `rstrip `.
2588+
25742589
25752590.. method :: str.swapcase()
25762591
0 commit comments