Skip to content

Commit 4ada03f

Browse files
[3.13] gh-106318: Add examples for str.rpartition() method (GH-143891) (#144041)
gh-106318: Add examples for str.rpartition() method (GH-143891) (cherry picked from commit 3c9c3d3) Co-authored-by: Adorilson Bezerra <[email protected]>
1 parent 48a8cd1 commit 4ada03f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,19 @@ expression support in the :mod:`re` module).
23212321
after the separator. If the separator is not found, return a 3-tuple containing
23222322
two empty strings, followed by the string itself.
23232323

2324+
For example:
2325+
2326+
.. doctest::
2327+
2328+
>>> 'Monty Python'.rpartition(' ')
2329+
('Monty', ' ', 'Python')
2330+
>>> "Monty Python's Flying Circus".rpartition(' ')
2331+
("Monty Python's Flying", ' ', 'Circus')
2332+
>>> 'Monty Python'.rpartition('-')
2333+
('', '', 'Monty Python')
2334+
2335+
See also :meth:`partition`.
2336+
23242337

23252338
.. method:: str.rsplit(sep=None, maxsplit=-1)
23262339

0 commit comments

Comments
 (0)