On Mar 26, 10:27 am, "W. Martin Borgert" wrote:
> 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?
As Christian explained, you're really after just '
On 2009-03-26 01:41, Christian Heimes wrote:
> No, you are wrong. file.readlines() reads the entire file into memory
> and returns a list of strings. If you want to iterate over the lines of
> a text file you can simply write:
>
> for line in myfile:
> dosomethingwith(line)
>
> It won't work fo
W. Martin Borgert schrieb:
> (Resend, because of funny error message:
>> Your mail to 'Python-list' with the subject
>> Iterating over readlines() and map()
>> Is being held until the list moderator can review it for approval.
> Whatever this means.)
>
> Hi,
>
> if I understand correctly, thi
(Resend, because of funny error message:
> Your mail to 'Python-list' with the subject
> Iterating over readlines() and map()
> Is being held until the list moderator can review it for approval.
Whatever this means.)
Hi,
if I understand correctly, this code would not read the complete file
in