Returns a list of the lines in the string, breaking at line boundaries.
- Optional. When set to True line breaks are included in the resulting list.
This method uses the universal newlines approach to splitting lines.
Unlike split() when a delimiter string sep is given, this method returns an empty list for the empty string, and a terminal line break does not result in an extra line.
>>> "AB\nCD\n".splitlines() ['AB', 'CD'] >>> "AB\nCD\n".splitlines(True) ['AB\n', 'CD\n'] >>> "\n\n".splitlines() ['', ''] >>> "".splitlines()