Run
my_string = "apple\nbanana\ncherry" lines = my_string.splitlines(True) print(lines)
Output