[perl-python] 20050121 file reading & writing

Bob Smith bob_smith_17280 at hotmail.com
Sat Jan 22 18:01:16 EST 2005

Xah Lee wrote:

> # reading entire file as a list, of lines
> # mylist = f.readlines()

To do this efficiently on a large file (dozens or hundreds of megs), you 
should use the 'sizehint' parameter so as not to use too much memory:

sizehint = 0
mylist = f.readlines(sizehint)

More information about the Python-list mailing list