[issue28937] str.split(): allow removing empty strings (when sep is not None)

Matthew Barnett report at bugs.python.org
Tue May 18 12:41:41 EDT 2021


Matthew Barnett <python at mrabarnett.plus.com> added the comment:

The case:

    '  a b c  '.split(maxsplit=1) == ['a', 'b c  ']

suggests that empty strings don't count towards maxsplit, otherwise it would return [' a b c  '] (i.e. the split would give ['', ' a b c  '] and dropping the empty strings would give [' a b c  ']).

----------

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


More information about the Python-bugs-list mailing list