FAQ
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!

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 5 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedMar 25, '09 at 8:16p
activeMar 26, '09 at 4:03a
posts5
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase