
正文
No module named 'urllib2'
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
import urllib2
response = urllib2.urlopen('http://www.baidu.com/')
html = response.read()
print html
报错
import urllib2
ImportError: No module named 'urllib2'
import urllib.request
resp=urllib.request.urlopen('http://www.baidu.com')
html=resp.read()
print(html)
在python3.3里面,用urllib.request代替urllib2








