Posted: Sat Sep 10, 2005 1:34 am Post subject: (No subject)
What's the difference between:
code:
for line in file('foo').readlines():
...
And:
code:
for line in file('foo'):
...
Hikaru79
Posted: Sat Sep 10, 2005 1:41 am Post subject: (No subject)
IRC wrote:
<wtd> In that same thread, there's another question up.
<Hikaru79> Oh, I know that one. I think.
<wtd> Nifty
<Hikaru79> Is it that 'readlines()' reads the whole file in at once and then splits it into iteratable lines, while the second one reads the file line by line?
<wtd> Indeed.
<Hikaru79> w00t =D