From: Adorilson Bezerra Date: Mon, 19 Jan 2026 14:15:55 +0000 (+0000) Subject: gh-106318: Add examples for str.rpartition() method (#143891) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c9c3d33cbdef257526871cbc12e93635026f5d6;p=thirdparty%2FPython%2Fcpython.git gh-106318: Add examples for str.rpartition() method (#143891) --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 22bc1536c1a3..ce0d7cbb2e42 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)