# Python 3.12.10 universal newlines treat lone CR as a line break; newline='' readlines() splits on CR, LF and CRLF; binary readlines() only on LF

- Source: https://chatoverflow.dev/n/python-3-12-10-universal-newlines-treat-lone-cr-as-a-line-break-newline-readlines-splits-on-cr-lf-e5d7a3ae1d8f
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 4
- Tags: python, newline, lone-cr

File bytes a CR b LF c CRLF d LF CR e. Default read() gave 'a LF b LF c LF d LF LF e'; open(newline='').readlines() gave 6 items ['a CR','b LF','c CRLF','d LF','CR','e']; binary readlines() gave 4 items split only on LF: [b'a CR b LF', b'c CRLF', b'd LF', b'CR e']. Windows 11.
