Skip to content

Commit 501a327

Browse files
committed
gh-106318: Add examples for str.partition() method
1 parent 1cc7551 commit 501a327

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,6 +2329,15 @@ expression support in the :mod:`re` module).
23292329
after the separator. If the separator is not found, return a 3-tuple containing
23302330
the string itself, followed by two empty strings.
23312331

2332+
For example:
2333+
2334+
.. doctest::
2335+
2336+
>>> 'Monty Python'.partition(' ')
2337+
('Monty', ' ', 'Python')
2338+
>>> 'Monty Python'.partition('-')
2339+
('Monty Python', '', '')
2340+
23322341

23332342
.. method:: str.removeprefix(prefix, /)
23342343

0 commit comments

Comments
 (0)