如何用urllib获取网页

opteroncx 发布于 2016-04-16 4227 次阅读


Python3中,urllib和urllib2合并了,原来的urllib2相当于urllib.request

import urllib.request as url
response = url.urlopen('http://www.baidu.com/')
html = response.read()
print(html)

这样就可以获取网页内容了

此作者没有提供个人介绍。
最后更新于 2016-04-16