Printing unix Line endings from Windows.
Ant
antroy at gmail.com
Tue Dec 5 03:29:51 EST 2006
Larry Bates wrote:
> Ant wrote:
...
> > Is there any way of doing this without having to post-process the file
> > in binary mode (a-la the crlf.py script)
...
> You can write to a new file and create your own line endings.
> When done, delete the original file and rename the output file.
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 ...
More information about the Python-list
mailing list