PyDocs

Nav

Python Runtime Services

str.splitlines

builtins

method of str
  • str.splitlines(keepends=False)
Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends
is given and true.
Changed in 3.2
  • 3.2: \v and \f added to list of line boundaries.
1 Example
>>> 'ab c\n\nde fg\rkl\r\n'.splitlines()
['ab c', '', 'de fg', 'kl']
>>> 'ab c\n\nde fg\rkl\r\n'.splitlines(keepends=True)
['ab c\n', '\n', 'de fg\r', 'kl\r\n']
from the Python docs
See Also
No see-alsos for builtins/str.splitlines
0 Notes
No notes for str.splitlines