]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-106318: Add examples for str.rpartition() method (GH-143891) (#144041)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 19 Jan 2026 14:22:24 +0000 (15:22 +0100)
committerGitHub <noreply@github.com>
Mon, 19 Jan 2026 14:22:24 +0000 (14:22 +0000)
gh-106318: Add examples for str.rpartition() method (GH-143891)
(cherry picked from commit 3c9c3d33cbdef257526871cbc12e93635026f5d6)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Doc/library/stdtypes.rst

index 34e27f72d6ff5cee7c4e9903007cf6a137c2b006..ca7313ef73308f71afe410617e3009ae5eddf0fa 100644 (file)
@@ -2321,6 +2321,19 @@ expression support in the :mod:`re` module).
    after the separator.  If the separator is not found, return a 3-tuple containing
    two empty strings, followed by the string itself.
 
+   For example:
+
+   .. doctest::
+
+      >>> 'Monty Python'.rpartition(' ')
+      ('Monty', ' ', 'Python')
+      >>> "Monty Python's Flying Circus".rpartition(' ')
+      ("Monty Python's Flying", ' ', 'Circus')
+      >>> 'Monty Python'.rpartition('-')
+      ('', '', 'Monty Python')
+
+   See also :meth:`partition`.
+
 
 .. method:: str.rsplit(sep=None, maxsplit=-1)