3 ms·
Related, Python has universal newlines support: https://www.google.com/search?q=python+universal+newlines+mode https://www.google.com/search?q=python+universal
by vram22 10y ago
Related, Python has universal newlines support:
https://www.google.com/search?q=python+universal+newlines+mode https://www.google.com/search?q=python+universal+newlines+mo...
Edit: added the PEP (it's from 2002) and excerpt from it:
https://www.python.org/dev/peps/pep-0278/ https://www.python.org/dev/peps/pep-0278/
This PEP discusses a way in which Python can support I/O on files which have a newline format that is not the native format on the platform, so that Python on each platform can read and import files with CR (Macintosh), LF (Unix) or CR LF (Windows) line endings.
- wiredfool 10y agoYeah, but it doesn't do \n \r, and iirc, it's not too happy when the line endings change midstream.
- vram22 10y agoInteresting, I had not checked it for those cases. Maybe it only reads a few lines at the start and assumes from the line endings for those, what it is going to be for the rest.