Printing unix Line endings from Windows.
Fredrik Lundh
fredrik at pythonware.com
Tue Dec 5 03:44:26 EST 2006
Ant wrote:
> How can I create my own line endings? I've tried setting os.linesep =
> "\n", (and to \x0a). I've tried things like:
>
> print "xxx yyy \n",
> print "xxx uuu \x0a",
> filehandle.write("xxx \n")
> filehandle.write("xxx \x0a")
>
> and all of these give me a nice windows-style crlf!
>
> Surely there must be a way to do this ...
endline normalization is done by the file object, on the way out. to
switch this off, open the output file in binary mode ("wb").
</F>
More information about the Python-list
mailing list