From 501a327a2b0cf2e0107788418aa1f65aaf9250f1 Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Wed, 12 May 2021 19:29:37 -0300 Subject: [PATCH 1/2] gh-106318: Add examples for str.partition() method --- Doc/library/stdtypes.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index f33b73238ec8b3..feee9d6da77dc8 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2329,6 +2329,15 @@ expression support in the :mod:`re` module). after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings. + For example: + + .. doctest:: + + >>> 'Monty Python'.partition(' ') + ('Monty', ' ', 'Python') + >>> 'Monty Python'.partition('-') + ('Monty Python', '', '') + .. method:: str.removeprefix(prefix, /) From e53633b7694a2873b1de0e484cb937bfbcbf6a9a Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Tue, 16 Dec 2025 13:26:10 +0000 Subject: [PATCH 2/2] gh-106318: Add 'See also rpartition()' on str.partition() method --- Doc/library/stdtypes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index feee9d6da77dc8..a927a0049db730 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2338,6 +2338,8 @@ expression support in the :mod:`re` module). >>> 'Monty Python'.partition('-') ('Monty Python', '', '') + See also :meth:`rpartition`. + .. method:: str.removeprefix(prefix, /)