python str has no attribute_python – AttributeError(“’str’object has no attribute’read’”)...
在Python我收到一个错误:
Exception: (,
AttributeError("'str' object has no attribute 'read'",), )
给定python代码:
def getEntries (self, sub):
url = 'http://www.reddit.com/'
if (sub != ''):
url += 'r/' + sub
request = urllib2.Request (url +
'.json', None, {'User-Agent' : 'Reddit desktop client by /user/RobinJ1995/'})
response = urllib2.urlopen (request)
jsonofabitch = response.read ()
return json.load (jsonofabitch)['data']['children']
这个错误意味着什么,我做了什么导致它?
python str has no attribute_python – AttributeError(“’str’object has no attribute’read’”)...相关推荐
- Python 报错解决:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
早上升级完pip,后报错如下: -> # pip install --upgrade pwntools /usr/local/lib/python2.7/dist-packages/pip/_v ...
- python中使用ZADD方法报错AttributeError: 'int' object has no attribute 'items'
redis的版本关系 正确的完整实例如下: import pymongo import redis# 代码作用是mongodb的数据传送到redis中去 handler = pymongo.Mongo ...
- python报错之 AttributeError: ‘list‘ object has no attribute ‘replace‘
a = ['a-b'] b = a.replace('-','') print(b) 报错: AttributeError: 'list' object has no attribute 'repla ...
- Python错误:AttributeError: 'generator' object has no attribute 'next'解决办法
今天在学习生成器对象(generation object)运行以下代码时,遇到了一个错误: #定义生成器函数 def liebiao(): for x in range(10): yield x #函 ...
- python 执行报错AttributeError: 'list' object has no attribute 'g'
^ SyntaxError: invalid syntax E:\数学-机器学习-西瓜书-周志华\UDACITY购课\project1 矩阵操作>python test.py Traceback ...
- Python学习笔记:‘’AttributeError: NoneType object has no attribute‘’
前言 最近在学习python,犯了很多低级错误,总结一下 目录 文章目录 前言 目录 问题 出处 方案 问题 AttributeError: 'NoneType' object has no attr ...
- python 错误AttributeError: ‘dict_keys‘ object has no attribute ‘sort‘
当运行Python代码时,出现以下错误: AttributeError: 'dict_keys' object has no attribute 'sort' 当代码有sort函数时,检查其他代码都没 ...
- Python 中 AttributeError: ‘NoneType‘ object has no attribute ‘X‘ 错误
文章目录 AttributeError: 'NoneType' object has no attribute 'X' 介绍 AttributeError: 'NoneType' object has ...
- python使用Axes3D画三维图加入legend图例时报错AttributeError: ‘Poly3DCollection‘ object has no attribute ‘_edgecolo
Q:python使用Axes3D画三维图加入legend图例时报错AttributeError: 'Poly3DCollection' object has no attribute '_edgeco ...
- Python错误集锦:pandas绘制多个子图时报错:AttributeError: ‘list’ object has no attribute ‘get_figure’
原文链接:http://www.juzicode.com/archives/3273 错误提示: 利用pandas绘制多个子图时报错:AttributeError: 'list' object has ...
最新文章
- 如何在域控制器上安装asp.net?
- 支撑亿级用户“刷手机”​,百度Feed流背后的新技术装备有多牛?
- python获取列表中元素的索引
- 天梯赛 L1-025 正整数A+B (15 分)
- 删除静态 IP 路由
- Python map/reduce
- 回调函数 相当于线程_阿里面试题:请简述下 Node 的线程模型
- 今天的绿得像碧玉的 飞鸽
- 我的软考之路(六)——数据结构与算法(4)之八大排序
- 使用CXF实现Webservice的服务接口提供以及相关的客户端实现
- hdu1861 游船出租【模拟】
- 23种Python设计模式之工厂方法模式详解
- 分子动力学模拟软件VMD的安装与使用
- python将英文翻译为中文_Python中英文翻译工具
- 消防信号总线原理_消防联动工作原理
- UART(Universal Asynchronous Receiver/Transmitter)
- EasyUI【DataGrid数据查询】
- 孙式太极拳的站桩(作者:孙剑云)
- 微信小程序云开发获取上传图片后https的url链接地址
- android 机器人动画,画一个可以动的Android 小机器人