Mixing iteration and read methods would lose data

Linux environment, the following figure 1 operation error, change to figure 2 form, in windows will not report an error, running well, the reason remains to be explored!

ValueError: Mixing iteration and read methods would lose data

lines = fr.readline ()

for line in lines[1:]

For large documents, read them line by line to extract the desired part to prevent too much memory and insufficient memory;

Read More: