W
W. Martin Borgert
Hi,
if I understand correctly, this code would not read the complete file
into the memory:
for line in myfile.readlines():
dosomethingwith(line)
Is this also true for this code?
for line in map(myfunction, myfile.readlines()):
dosomethingwith(line)
Or would use of map() mean, that the complete "myfile" is read into
the RAM? In this case, I would change it to:
for line in myfile.readlines():
line = myfunction(line)
dosomethingwith(line)
TIA!
if I understand correctly, this code would not read the complete file
into the memory:
for line in myfile.readlines():
dosomethingwith(line)
Is this also true for this code?
for line in map(myfunction, myfile.readlines()):
dosomethingwith(line)
Or would use of map() mean, that the complete "myfile" is read into
the RAM? In this case, I would change it to:
for line in myfile.readlines():
line = myfunction(line)
dosomethingwith(line)
TIA!