1、urllib2在Python3已拆分更名为urllib.request和urllib.error
2、示例
1 import urllib.request 2 3 def getHtml(url): 4 page = urllib.request.urlopen(url) 5 html = page.read() 6 return html 7 8 html = getHtml("http://www.baidu.com") 9 10 print(html)