Printing unix Line endings from Windows.
Larry Bates
larry.bates at websafe.com
Mon Dec 4 12:20:42 EST 2006
Ant wrote:
> Hi all,
>
> I've got a problem here which has me stumped. I've got a python script
> which does some text processing on some files and writes it back out to
> the same file using the fileinput module with inplace set to True.
>
> The script needs to run from Windows, but the files need to be written
> with Unix line endings.
>
> Is there any way of doing this without having to post-process the file
> in binary mode (a-la the crlf.py script)
>
> Cheers,
>
You can write to a new file and create your own line endings.
When done, delete the original file and rename the output file.
-Larry
More information about the Python-list
mailing list