#!/usr/bin/python import httplib httpconn = httplib.HTTPConnection("HdhCmsTestbaidu测试数据") httpconn.request("GET", "/index.html") resp = httpconn.getresponse() if resp.reason == "OK": resp_data = resp.read() print resp_data print len(resp_data) httpconn.close()
要下载的网页源码被读取到了resp_data中了
运行效果图如下:
以上就是Python实现网页中下载的功能实例的详细内容,更多请关注Gxl网其它相关文章!
查看更多关于Python实现网页中下载的功能实例的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did81817