]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106318: Add examples for str.rpartition() method (#143891)
authorAdorilson Bezerra <adorilson@gmail.com>
Mon, 19 Jan 2026 14:15:55 +0000 (14:15 +0000)
committerGitHub <noreply@github.com>
Mon, 19 Jan 2026 14:15:55 +0000 (15:15 +0100)
Doc/library/stdtypes.rst

index 22bc1536c1a37b1fe1f8778221141cfa8ebb472a..ce0d7cbb2e42768fce82bde2abdeec3358672936 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)