how long a Str can be used in this python code segment?

Antoine Pitrou solipsis at pitrou.net
Mon Feb 1 11:53:01 EST 2010


Le Mon, 01 Feb 2010 01:33:09 -0800, Stephen.Wu a écrit :
> 
> actually, I just use file.read(length) way, i just want to know what
> exactly para of length I should set, I'm afraid length doesn't equal to
> the amount of physical memory after trials...

There's no exact length you "should" set, just set something big enough 
that looping doesn't add any noticeable overhead, but small enough that 
it doesn't take too much memory. Something between 64kB and 1MB sounds 
reasonable.





More information about the Python-list mailing list