How to write text files with DOS line endings on linux

Posted by gaumann on Stack Overflow See other posts from Stack Overflow or by gaumann
Published on 2010-04-15T00:55:13Z Indexed on 2010/04/15 1:03 UTC
Read the original article Hit count: 324

Filed under:
|
|

I want to write text files with DOS/Windows line endings '\r\n' using python running on Linux. It seems to me that there must be a better way than manually putting a '\r\n' at the end of every line or using a line ending conversion utility. Ideally I would like to be able to do something like assign to os.linesep the separator that I want to use when writing the file. Or specify the line separator when I open the file.

© Stack Overflow or respective owner

Related posts about python

Related posts about Windows