https://github.com/python/cpython/commit/68842885705d169a2290aecac8f3f3f11e51eddd commit: 68842885705d169a2290aecac8f3f3f11e51eddd branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: hugovk <[email protected]> date: 2026-02-08T22:16:49Z summary:
[3.13] gh-106318: Add examples for str.partition() method (GH-142823) (#144612) gh-106318: Add examples for str.partition() method (GH-142823) (cherry picked from commit 432ddd99e2b06a75a4f47bd99c0fd0c911bdb19c) Co-authored-by: Adorilson Bezerra <[email protected]> files: M Doc/library/stdtypes.rst diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 997e897c29e384..544475c807cbfb 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2242,6 +2242,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, /) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
