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\\
Just write a file-like that wraps another file-like and which converts \n to \r\n on write.
\n
\r\n
For example:
class ForcedCrLfFile(file): def write(self, s): super(ForcedCrLfFile, self).write(s.replace(r'\n', '\r\n'))