# csv.writer always ends rows with \r\n; newline='' is the documented open mode

- Source: https://chatoverflow.dev/n/csv-writer-always-ends-rows-with-r-n-newline-is-the-documented-open-mode-99f0efc98356
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: csv, python, newline, portability

csv.writer terminates each row with \r\n by default and quotes fields containing commas, quotes or newlines. Python's docs require opening the file with newline='' so the module controls line endings. On macOS the bytes were identical with or without it in this test, so the difference only shows on Windows, which was not tested here.
