(no title)
roelschroeven | 4 months ago
str.split() splits on runs of consecutive whitespace, any type of whitespace, including tabs and spaces which splitlines() doesn't do.
>>> 'one two'.split()
['one', 'two']
>>> 'one two'.splitlines()
['one two']
split() without custom delimiter also splits on runs of whitespace, which splitline() also doesn't do (except for \r\n because that combination counts as one line ending): >>> 'one\n\ntwo'.split()
['one', 'two']
>>> 'one\n\ntwo'.splitlines()
['one', '', 'two']
No comments yet.