result = [] splitfrom = 0 for i in range(len(data)): if data[i] == '\n': result.append(data[splitfrom : i + 1]) splitfrom = i + 1