作者:梦幻死灵_791 | 来源:互联网 | 2023-06-25 16:55
Python3.3之后,urllib2改为urllib.responsePython2.7代码:importurllib2responseurllib2.
Python 3.3之后,urllib2改为urllib.response
Python 2.7 代码:
import urllib2
respOnse= urllib2.urlopen('http://www.baidu.com/')
html = response.read()
print html
Python 3.3 代码应该为:
import urllib.request
respOnse=urllib.request.urlopen('http://www.baidu.com')
html=response.read()
print(html)