The readlines() function loads the entire file into memory as it runs. A better approach for large files is to use the
fileinput
module, as follows:import fileinput
for line in fileinput.input(['myfile']):
print(line)
No comments:
Post a Comment