I have large txt-files which happen to have the combination CRLFCRLF as end-of-line.
I have to change this to CRLF to be able to work with this file.
Text-Editor Replace and Text-Editor Makros take too long, because the file is 8 GB.
How can I do it with Python 2.7? I tried the following, but it does not change the file. When I try with a keyboardable-string, e.g. replace('a','A')
, or replace('BUS','CAR')
, it works:
f1 = open('C:/temp/Textfile1.txt', 'r')
f2 = open('C:/temp/Textfile2.txt', 'w')
string = f1.read()
string = string.replace('\r\n\r\n','\r\n')
f2.write(string)
f1.close()
f2.close()