[Python-Dev] New lines, carriage returns, and Windows (original) (raw)
skip at pobox.com skip at pobox.com
Thu Sep 27 04:46:07 CEST 2007
- Previous message: [Python-Dev] New lines, carriage returns, and Windows
- Next message: [Python-Dev] New lines, carriage returns, and Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg> Maybe there should be a universal newlines mode defined for output
Greg> as well as input, which translates any of "\r", "\n" or "\r\n"
Greg> into the platform line ending.I thought that's the way it was supposed to work, but it clearly doesn't:
>>> f = open("test.txt", "wt")
>>> f.write("a\rb\rnc\n")
7
>>> f.close()
>>> open("test.txt", "rb").read()
b'a\rb\rnc\n'I'd be open to such a change. Principle of least surprise?
Skip
- Previous message: [Python-Dev] New lines, carriage returns, and Windows
- Next message: [Python-Dev] New lines, carriage returns, and Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]