import urllib2 response = urllib2.urlopen('http://www.baidu.com/') html = response.read()print html
報(bào)錯(cuò)
import urllib2
ImportError: No module named 'urllib2'
import urllib.requestresp=urllib.request.urlopen('http://www.baidu.com')html=resp.read()print(html)
在python3.3里面度硝,用urllib.request代替urllib2