I am a newbie. However, I managed to extract some lines from a txt-file (unicode) and write them in another file.
lines = InFile.readlines() OutFile.writeli
I'm fairly certain that your input file is UTF-16 encoded, and the spaces you're seeing are actually null bytes.
Try
with open("myfile.txt", "r", encoding="utf-16") as infile: lines = infile.readlines()
and see if the problem persists.