From ec39b6687844567f86cd7e9e365185a48ceb40d6 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:22:03 +0100 Subject: [PATCH] [3.14] gh-106318: Add examples for str.rpartition() method (GH-143891) (#144040) gh-106318: Add examples for str.rpartition() method (GH-143891) (cherry picked from commit 3c9c3d33cbdef257526871cbc12e93635026f5d6) Co-authored-by: Adorilson Bezerra --- Doc/library/stdtypes.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 85e42876e2fa..67a0fa8afbd3 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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) -- 2.47.3