[3.14] gh-106318: Add examples for str.partition() method (GH-142823) (#144611)

gh-106318: Add examples for str.partition() method (GH-142823)
(cherry picked from commit 432ddd99e2)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
This commit is contained in:
Miss Islington (bot) 2026-02-08 23:17:46 +01:00 committed by GitHub
parent 2494a90fbc
commit 27baa1cd5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2483,6 +2483,19 @@ 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's Flying Circus".partition(' ')
('Monty', ' ', "Python's Flying Circus")
>>> 'Monty Python'.partition('-')
('Monty Python', '', '')
See also :meth:`rpartition`.
.. method:: str.removeprefix(prefix, /)