reading in lines from a file -FAST!

Erik Max Francis max at alcyone.com
Thu Jul 31 04:05:13 CEST 2003


Mark Day wrote:

> How about:
>     s = f.read()
> (assuming f is a file object)

Or, if he wants to do it 1.7 MB at a time, something like:

	while True:
	    chunk = f.read(1700000)
	    if not chunk:
	        break
	    # handle chunk here

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ Life is a zoo in a jungle.
\__/  Peter de Vries




More information about the Python-list mailing list