Dealing with Windows line-endings in Python
- by Adam Nelson
I've got a 700MB XML file coming from a Windows provider.
As one might expect, the line endings are '\r\n' (or ^M in vi). What is the most efficient way to deal with this situation aside from getting the supplier to send over '\n' :-)
Use os.linesep
Use rstrip() (requiring opening the file ... which seems crazy)
Using Universal newline support…