Fastest way to retrieve and write html contents to file
Stephen Hansen
me+python at ixokai.io
Mon May 2 01:15:36 EDT 2016
On Sun, May 1, 2016, at 10:00 PM, DFS wrote:
> I tried the 10-loop test several times with all versions.
Also how, _exactly_, are you testing this?
C:\Python27>python -m timeit "filename='C:\\test.txt';
webpage='http://econpy.pythonanywhere.com/ex/001.html'; import urllib2;
r = urllib2.urlopen(webpage); f = open(filename, 'w');
f.write(r.read()); f.close();"
10 loops, best of 3: 175 msec per loop
That's a whole lot less the 0.88secs.
--
Stephen Hansen
m e @ i x o k a i . i o
More information about the Python-list
mailing list