On 19 Aug 2005 03:43:31 -0700
Paul Rubin wrote:

> <[EMAIL PROTECTED]> writes:
> > import itertools
> > f = open("blah.txt", "r")
> > for c in itertools.chain(*f):
> 
> But that can burn an unlimited amount of memory if there are long
> stretches of the file with no newlines.  There's no real good way
> around ugly code.

I agree. Moreover, in fact, it is the same as just

for c in f.read():
     # ...

-- 
jk
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to