Hi, I had a hard time, earlier today, figuring out what was the rules for converting newline characters (only from the code of io.TextIOWrapper). So, I wrote some notes for myself. I don't know if there's any documentation about this yet -- that is why am posting my notes to the list. Free it to use them for whatever you want to.
Cheers, -- Alexandre Known newline type: LF: \n or "universal newline" CRLF: \r\n CR: \r Argument | value | Notes ---------+------------------------------------------------------- None | Default mode for open(). | LF are converted to the value of os.linesep on writes. | Convert any known newline type to LF on reads. | Readline splits on LF. ---------+------------------------------------------------------- "" | No conversions on writes. | No conversions on reads. | Readline splits on any known newline type. ---------+------------------------------------------------------- LF | Default mode for StringIO. | No conversions on writes. | No conversions on reads. | Readline splits on LF. ---------+------------------------------------------------------- CRLF | Convert LF to CRLF on writes. | No conversions on reads. | Readline splits on CRLF. ---------+------------------------------------------------------- CR | Convert LF to CR on writes. | No conversions on reads. | Readline splits on CR. ---------+------------------------------------------------------- _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com