Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2620,7 +2620,9 @@ expression support in the :mod:`re` module).
:func:`re.split`). Splitting an empty string with a specified separator
returns ``['']``.

For example::
For example:

.. doctest::

>>> '1,2,3'.split(',')
['1', '2', '3']
Expand All @@ -2638,7 +2640,9 @@ expression support in the :mod:`re` module).
string or a string consisting of just whitespace with a ``None`` separator
returns ``[]``.

For example::
For example:

.. doctest::

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

For example::
For example:

.. doctest::

>>> "".split(None, 0)
[]
Expand All @@ -2659,7 +2665,7 @@ expression support in the :mod:`re` module).
>>> " foo ".split(maxsplit=0)
['foo ']

See also :meth:`join`.
See also :meth:`join` and :meth:`rsplit`.


.. index::
Expand Down
Loading