[issue38247] list(str.split(ch)) Does not print blank elements upon repeating character(ch)

Ammar Askar report at bugs.python.org
Sat Sep 21 19:19:45 EDT 2019


Ammar Askar <ammar at ammaraskar.com> added the comment:

For whitespace, the correct way to achieve this using split() with no argument:

>>> print(list("Hello World How Are You?".split()))
['Hello', 'World', 'How', 'Are', 'You?']
>>> print(list("Hello World       How Are      You?".split()))
['Hello', 'World', 'How', 'Are', 'You?']

Your proposed solution would be a breaking change to all code that relies on the old style.

----------
nosy: +ammar2

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38247>
_______________________________________


More information about the Python-bugs-list mailing list