bug? file.write('\n') produces a carriage return and a line feed

jcb at iteris.com jcb at iteris.com
Wed Dec 14 19:03:04 EST 2005


The following code in Python 2.3
f = file('t.txt', 'wt')
f.write('\n')
f.close()

writes
0D0A  to the file.

Is this a bug or expected behavior?
It sure took me by surprise.

If it is not a bug, is this behavior documented?




More information about the Python-list mailing list