FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-106318: Add doctest role and a 'See also' item for str.split() by adorilson · Pull Request #144367 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
14 changes: 10 additions & 4 deletions Doc/library/stdtypes.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL