Python 3 read() function
skip at pobox.com
skip at pobox.com
Thu Dec 4 12:49:34 EST 2008
>>> huge = io.open("C:\HUGE_FILE.pcl",'r+b',0)
Why do you want to disable buffering? From the io.open help:
open(file, mode='r', buffering=None, encoding=None, errors=None,
newline=None, closefd=True)
Open file and return a stream. Raise IOError upon failure.
...
buffering is an optional integer used to set the buffering policy. By
default full buffering is on. Pass 0 to switch buffering off (only
allowed in binary mode), 1 to set line buffering, and an integer > 1
for full buffering.
I think you will get better performance if you open the file without the
third arg:
huge = io.open("C:\HUGE_FILE.pcl",'r+b')
--
Skip Montanaro - skip at pobox.com - http://smontanaro.dyndns.org/
More information about the Python-list
mailing list