You need to specify the newline character when you open the file. On Windows, the default ends up adding an extra '\r'
.
with open('quotes.csv', 'a', newline="\n") as myFile:
writer = csv.DictWriter(myFile, fieldnames=fieldnames)
...
1
solved i don’t know why this code is writing empty rows on my csv file when using a PC but not on a Mac