I have this .log file that I changed the extension name into .txt file but it still reads as log file
but after I copied it and paste it a new editor and sa
In Python you can specify the input encoding.
with open('trendx.log', 'r', encoding='utf-16le') as reader, \
open('trendx.txt', 'w') as writer:
for line in reader:
if "ROW" in line:
writer.write(line)
I have obviously copied over some stuff from your earlier questions. Kudos for finally identifying the actual problem.
Notice in particular how we avoid reading the entire file into memory and instead processing a line at a time.