python3.5中urlopen出错

来源:互联网 发布:md5解密算法java 编辑:程序博客网 时间:2024/06/05 06:08

在Python3.5中urllib已经被整合了
具体官方文档:
a new urllib package was created. It consists of code from
urllib, urllib2, urlparse, and robotparser. The old
modules have all been removed. The new package has five submodules:
urllib.parse, urllib.request, urllib.response,
urllib.error, and urllib.robotparser. The
urllib.request.urlopen() function uses the url opener from
urllib2. (Note that the unittests have not been renamed for the
beta, but they will be renamed in the future.)

urlopen()用法:
import urllib.request
url=”http://www.baidu.com”
get=urllib.request.urlopen(url).read()
print(get)

0 0