Skip to content

Commit 38371e5

Browse files
adorilsonmiss-islington
authored andcommitted
gh-106318: Add doctest role and a 'See also' to the str.split() docs (GH-144367)
(cherry picked from commit a96cba5) Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
1 parent f3956c6 commit 38371e5

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

Doc/library/stdtypes.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,7 +2616,9 @@ expression support in the :mod:`re` module).
26162616
:func:`re.split`). Splitting an empty string with a specified separator
26172617
returns ``['']``.
26182618

2619-
For example::
2619+
For example:
2620+
2621+
.. doctest::
26202622

26212623
>>> '1,2,3'.split(',')
26222624
['1', '2', '3']
@@ -2634,7 +2636,9 @@ expression support in the :mod:`re` module).
26342636
string or a string consisting of just whitespace with a ``None`` separator
26352637
returns ``[]``.
26362638

2637-
For example::
2639+
For example:
2640+
2641+
.. doctest::
26382642

26392643
>>> '1 2 3'.split()
26402644
['1', '2', '3']
@@ -2646,7 +2650,9 @@ expression support in the :mod:`re` module).
26462650
If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only
26472651
leading runs of consecutive whitespace are considered.
26482652

2649-
For example::
2653+
For example:
2654+
2655+
.. doctest::
26502656

26512657
>>> "".split(None, 0)
26522658
[]
@@ -2655,7 +2661,7 @@ expression support in the :mod:`re` module).
26552661
>>> " foo ".split(maxsplit=0)
26562662
['foo ']
26572663

2658-
See also :meth:`join`.
2664+
See also :meth:`join` and :meth:`rsplit`.
26592665

26602666

26612667
.. index::

0 commit comments

Comments
 (0)