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

原文地址:https://www.cnblogs.com/duole/p/5522582.html