D
Dennis Lee Bieber
I don't think it is. Behaviour is a little different between Python 2 and
3, but by default, Python uses "Universal Newlines". When you open a file
Oh? When did that change come about... So far as I recall, Python 2.x
introduced a "universal newline" mode character for the open() function.
IE, one had to explicitly ask for universal mode during the open.
Python 2.7 help file
"""
open(filename[, mode[, bufsize]])
<snip>
to 'r'. The default is to use text mode, which may convert '\n' characters
to a platform-specific representation on writing and back on reading. Thus,
when opening a binary file, you should append 'b' to the mode value to open
the file in binary mode, which will improve portability. (Appending 'b' is
<snip>
In addition to the standard fopen() values mode may be 'U' or 'rU'. Python
is usually built with universal newline support; supplying 'U' opens the
file as a text file, but lines may be terminated by any of the following:
the Unix end-of-line convention '\n', the Macintosh convention '\r', or the
Windows convention '\r\n'. All of these external representations are seen
as '\n' by the Python program. If Python is built without universal newline
support a mode with 'U' is the same as normal text mode. Note that file
objects so opened also have an attribute called newlines which has a value
of None (if no newlines have yet been seen), '\n', '\r', '\r\n', or a tuple
containing all the newline types seen.
"""
Seems to be silent with regards to /writing/; suspect writing will use
the system convention unless using "wb"/"ab" to force binary mode.