Excel 15 on MacOS Sierra isn't displaying line breaks for some reason.
I have some simple Python code that creates a csv
output = "test.csv"
sensor_names = ["A", "B", "C"]
data = [ [1,2,3], [4,5,6], None, [10,11,12] ]
with open(output, "wb", newline='') as fp:
fp.write(",".join(sensor_names))
fp.write("\n")
for line in data:
if line is None:
fp.write("\n")
continue
fp.write(",".join(str(x) for x in line))
fp.write("\n")
This code produces one line break, and when I open it with a text editor, I see a blank line. But when I open it in Excel, then the blank line doesn't show up.
If I put two new lines \n\n, then a blank shows up in Excel, but then there are actually two new lines in the actual file, which I don't want.
Also putting \r\n worked, but again, that adds an unwanted character since I'm not using Windows.
Any solutions to this?