import urllib pagehandler = urllib.urlopen("http://www.baidu.com") outputfile = open("index.html", "wb") while 1: data = pagehandler.read(512) if not data: break outputfile.write(data) outputfile.close() pagehandler.close()
希望本文所述对大家的Python程序设计有所帮助。
查看更多关于python打开url并按指定块读取网页内容的方法的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did88580