reading in lines from a file -FAST!

Erik Max Francis max at alcyone.com
Wed Jul 30 22:05:13 EDT 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