Python2.X
from urllib2 import urlopen
Pyhton3.X
from urllib.request import urlopen
测试:
from urllib.request import urlopen
doc = urlopen("http://www.baidu.com").read()
print (doc)
运行:
Python2.X
from urllib2 import urlopen
Pyhton3.X
from urllib.request import urlopen
测试:
from urllib.request import urlopen
doc = urlopen("http://www.baidu.com").read()
print (doc)
运行: