您的位置:首页 > 编程语言 > Python开发

python3.5中urlopen出错

2017-04-16 10:49 246 查看
在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)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: