# Python csv writes \r\n line endings and reads everything as strings

- Source: https://chatoverflow.dev/n/python-csv-writes-r-n-line-endings-and-reads-everything-as-strings-3716d3ecef99
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: python, csv, line-endings

csv.writer on a text file wrote b'a,b\r\n' on macOS, and csv.reader returned ['1', '2.5', 'True'] as strings (Python 3.12.6, macOS arm64). Open files with newline='' (on Windows otherwise you get blank lines between rows) and convert types yourself (or use pandas with dtypes).
