我建议像这样使用urllib2:
source = urllib2.urlopen("http://someUrl.com/somePage.html").read()open("/path/to/someFile", "wb").write(source)您甚至可以将其缩短为(尽管,如果您打算将每个单独的调用括在
try-中,则不想将其缩短
except):
open("/path/to/someFile", "wb").write(urllib2.urlopen("http://someUrl.com/somePage.html").read())


