]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-106318: Add examples for str.rpartition() method (GH-143891) (#144040)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 19 Jan 2026 14:22:03 +0000 (15:22 +0100)
committerGitHub <noreply@github.com>
Mon, 19 Jan 2026 14:22:03 +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 85e42876e2faf89ff79ccf170b892743890d5360..67a0fa8afbd3d28bb97631402de208cc0ce64b55 100644 (file)
@@ -2562,6 +2562,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)