Disable "universal newlines" to avoid unwanted changes
Since Python 3, when reading from a file opened in text mode, different end of line characters are handled transparently by default regardless of the underlying operating system, however when writing to text file the system default line separator is always used. Disabling "universal newlines" will make foreign line separators appear in the strings returned by readlines() and the regexp will handle them like any other control character (eg. \t) and they will be written to the output file. The documentation of universal newlines is at http://docs.python.org/3/library/functions.html#open
Loading
Please register or sign in to comment