How to process huge text files that contain EOF / Ctrl-Z characters using Python on Windows?
It’s easy to use Python to delete the DOS EOF chars; for example, def delete_eof(fin, fout): BUFSIZE = 2**15 EOFCHAR = chr(26) data = fin.read(BUFSIZE) while data: fout.write(data.translate(None, EOFCHAR)) data = fin.read(BUFSIZE) import sys ipath = sys.argv[1] opath = ipath + “.new” with open(ipath, “rb”) as fin, open(opath, “wb”) as fout: delete_eof(fin, fout) That takes … Read more