比如爬baidu.com, 在python 3.4 中应该这么写
import urllib.request
def getHtml(url):
page = urllib.request.urlopen(url)
html = page.read()
return html
html = getHtml("http://baidu.com")
print (html)
print 的语法在2 跟3 中不一样
print ("hello") in python 3
No module named 'urllib2'
python3.3里面,用urllib.request代替urllib2
参考官方文档 https://docs.python.org/3/