file.write[lines]() weirdness
Martin v. Löwis
loewis at informatik.hu-berlin.de
Tue Apr 2 10:08:36 EST 2002
netzapper at magicstar.net (A. Jones) writes:
> Any insight would be much appreciated.
Seeking and text mode does not really mix well. When you write to a
text file, the C library may expand or collapse newline characters,
and perform other modifications. So if you write n bytes to a text
file, that doesn't mean that n bytes end on disk.
I recommend to open the file in binary.
Regards,
Martin
More information about the Python-list
mailing list