Difference between readlines() and iterating on a file object?
Richard
richardd at hmgcc.gov.uk
Fri Aug 13 10:32:34 EDT 2004
Hi,
Can anyone tell me what the difference is between
for line in file.readlines( ):
and
for line in file:
where file is a file object returned from an open( ) call?
I thought that they did the same thing, but the code I am using it in has
this line called more than once on the same file object and the second time
it is ran gives different results for each.
What is the difference in implementation?
Cheers
Rich
More information about the Python-list
mailing list