mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
[3.13] gh-133986: Document string split algorithm when sep is None and maxsplit is 0 (GH-133987) (#133992)
gh-133986: Document string split algorithm when sep is None and maxsplit is 0 (GH-133987)
---------
(cherry picked from commit 3e23047363
)
Co-authored-by: Joey Smith <joeysmith@gmail.com>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
This commit is contained in:
parent
f474264b1e
commit
bd3add06f6
1 changed files with 12 additions and 0 deletions
|
@ -2133,6 +2133,18 @@ expression support in the :mod:`re` module).
|
||||||
>>> ' 1 2 3 '.split()
|
>>> ' 1 2 3 '.split()
|
||||||
['1', '2', '3']
|
['1', '2', '3']
|
||||||
|
|
||||||
|
If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only
|
||||||
|
leading runs of consecutive whitespace are considered.
|
||||||
|
|
||||||
|
For example::
|
||||||
|
|
||||||
|
>>> "".split(None, 0)
|
||||||
|
[]
|
||||||
|
>>> " ".split(None, 0)
|
||||||
|
[]
|
||||||
|
>>> " foo ".split(maxsplit=0)
|
||||||
|
['foo ']
|
||||||
|
|
||||||
|
|
||||||
.. index::
|
.. index::
|
||||||
single: universal newlines; str.splitlines method
|
single: universal newlines; str.splitlines method
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue