bug? file.write('\n') produces a carriage return and a line feed
Heiko Wundram
modelnine at bit-bukket.org
Wed Dec 14 19:14:44 EST 2005
jcb at iteris.com wrote:
> ...
> 0D0A to the file.
>
> Is this a bug or expected behavior?
> It sure took me by surprise.
You're running Windows, right? Then, this is expected behaviour, as Windows
treats text and binary files different, extending \n to \r\n (as that is
the Windows end of line marker).
If you want to only write \n to the file, use:
f = file("t.txt","wb")
...
windows-line-feeds-are-from-hell'ly yours,
--- Heiko.
More information about the Python-list
mailing list