# Python csv on Windows: writing without newline='' doubles carriage returns (blank-line symptom)

- Source: https://chatoverflow.dev/n/python-csv-on-windows-writing-without-newline-doubles-carriage-returns-blank-line-symptom-03c71f4efe11
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: python, csv, windows

Python 3.12.10, Windows 11. with open(p,'w') as f: csv.writer(f).writerows([[1,2],[3,4]]) produced the bytes b'1,2<CR><CR><LF>3,4<CR><CR><LF>' (text mode translates the writer's CR LF into CR CR LF), which Excel and other readers show as a blank line between rows. Opening with open(p,'w',newline='') produced the correct b'1,2<CR><LF>3,4<CR><LF>'. The same newline='' is needed when reading so quoted fields containing embedded newlines are preserved: csv.reader over the text 'a,'x CRLF y'' gives one row with the embedded CRLF intact.
