[issue22232] str.splitlines splitting on non-\r\n characters
Serhiy Storchaka
report at bugs.python.org
Fri Oct 5 02:42:34 EDT 2018
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
If change the default behavior we need to wait several releases after adding this option. Users should be able to pick the current behavior explicitly.
Currently the workaround is using regular expressions.
For s.splitlines(keepends=False):
re.split(r'\n|\r\n?', s)
For s.splitlines(keepends=True):
re.split(r'(?<=\n)|(?<=\r)(?!\n)', s)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue22232>
_______________________________________
More information about the Python-bugs-list
mailing list