In fact, as one of the Peter's (either Otten or Hansen) explained to me,
for line in open(file):
is actually both faster (being buffered) and generally better for very large files because it doesn't read the whole file into memory, like readlines does (if you have a memory limitation).
On Fri, 29 Apr 2005 12:00:37 -0400, Kent Johnson <[EMAIL PROTECTED]> wrote:
Maksim Kasimov wrote:Kent Johnson wrote:
> for line in open(path):
the line of your example raise another question: opened file will be read at once time, as method readlines() do, or it will be read line by line as method readline() do.
It will be read line by line as readline() does.
as far i know, it is depends on implementation of method "__iter__" of the object that "open()" returns, so another question: where i can find such an information (about how does such a functions works)?
http://docs.python.org/lib/built-in-funcs.html http://docs.python.org/lib/bltin-file-objects.html
Kent
-- http://mail.python.org/mailman/listinfo/python-list