The following code...
import sys
if sys.platform == "win32":
import os, msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
sys.stdout.write("This is a sample line of text\n")
...results in the stdio output ending with 0x0d
followed by 0x0a
. stdio is set to binary mode. Why is the write()
call still substituting \r\n
for \n
?