AttributeError: 'dict' object has no attribute 'iteritems'
在python3.6中
运行
sortedClassCount = sorted(classCount.iteritems(), key=operator.itemgetter(1), reverse=True)
会出现AttributeError: 'dict' object has no attribute 'iteritems'的错误提醒
纠正错误的方法为:
iteritems变为items
即
sortedClassCount = sorted(classCount.items(), key=operator.itemgetter(1), reverse=True)
AttributeError: 'dict' object has no attribute 'iteritems'的更多相关文章
- facenet pyhton3.5 训练 train_softmax.py 时报错AttributeError: 'dict' object has no attribute 'iteritems'
报错原因:在进行facenet进行train_softmax.py训练时,在一轮训练结束进行验证时,报错AttributeError: 'dict' object has no attribute ' ...
- 机器学习实战:KNN代码报错“AttributeError: 'dict' object has no attribute 'iteritems'”
报错代码: sortedClassCount = sorted(classCount.iteritems(), key=operator.itemgetter(1), reverse=True) 解决 ...
- AttributeError: 'dict' object has no attribute 'has_key'
运行下面的代码: if (locals().has_key('data')): del data gc.collect() 出错: if (locals().has_key('data')): Att ...
- celery:Unrecoverable error: AttributeError("'unicode' object has no attribute 'iteritems')
环境描述 python2+django1.9下使用celery异步处理耗时请求. celery使用的是celery-with-redis这个第三方库,版本号为3.0. pip install cele ...
- AttributeError: 'dict' object has no attribute 'encode'
首先这是一个很简单的 运行时错误: 错误分析: AttributeError:属性错误,造成这种错误的原因可能有: 你尝试访问一个不存在的属性或方法.检查一下拼写!你可以使用内建函数 dir 来列出存 ...
- flask 表单填充数据报错!AttributeError: 'dict' object has no attribute 'getlist'
报错信息: AttributeError: 'dict' object has no attribute 'getlist' 解决: 虽然是小毛病,不得不说还是自己太粗心大意了.
- AttributeError: 'dict' object has no attribute 'status_code'
前端AJAX请求数据,提示错误:“AttributeError: 'dict' object has no attribute 'status_code'”. 原因:是提示返回对象dict没有“sta ...
- 'dict' object has no attribute 'a'
a = {} #a.a = 'a' #AttributeError: 'dict' object has no attribute 'a' #a['a'] #KeyError: 'a' a['a'] ...
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
随机推荐
- MFC 如何在一个窗体中嵌套在另一个窗体中
其中的一个方法是讲子窗体设置为非模式对话框,具体操作为 :设置子窗体的border属性为none,style为 child. 在父窗体中需要用create来实现,具体例子如下. 在父窗体的OnInit ...
- cookie、localStorage、sessionStorage和会话控制机制
简介 cookie cookie的内容主要包括:名字Name.值Value.域Domain.路径Path.过期时间Expires/Max-Age.大小Size.HTTP.Secure.SameSite ...
- linux驱动开发(三) 字符设备驱动框架
还是老规矩先上代码 demo.c #include <linux/init.h> #include <linux/module.h> #include <linux/ke ...
- NRF51822之使用外部32Mhz晶振
硬件平台为微雪BLE400的(将原来的16mhz晶振改为32mhz.两个旁电容改为22pf) 以nRF51_SDK_10.0.0_dc26b5e\examples\ble_peripheral\ble ...
- PHP中Notice: unserialize(): Error at offset of bytes in on line 的解决方法
使用unserialize函数将数据储存到数据库的时候遇到了这个报错,后来发现是将gb2312转换成utf-8格式之后,每个中文的字节数从2个增加到3个之后导致了反序列化的时候判断字符长度出现了问题, ...
- Kibana安装与基本用法(ELK)
强制使用smtp 465端口加密发送邮件: vim kibana.yml 添加如下: sentinl: settings: email: active: true user: wjoyxt@.com ...
- Python开发环境搭建指导
本文主要介绍Python开发环境的搭建.主要包括如下几部分内容: (1)Python软件的安装.注意版本的选择和安装过程中选项的勾选. (2)pip工具环境变量.镜像源的配置使用和常用镜像源介绍.pi ...
- Delphi动态配置ODBC数据源--SQL Server版本
(摘自)http://jxlearnew.blog.163.com/blog/static/549786592007102451431413/ 这里介绍一种用Delphi来实现动态注册的方法,希望对各 ...
- GIS案例学习笔记-水文分析河网提取地理建模
GIS案例学习笔记-水文分析河网提取地理建模 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 目的:针对数字高程模型,通过水文分析,提取河网 操作时间:25分钟 数据 ...
- KJMusic完整音乐项目
KJMusic完整音乐项目 KJMusic是一个完整音乐项目,这个项目从欢迎页面到首页以及音乐播放页面都做得非常不错.并且本音乐支持本地音乐,和音乐电台,支持切换上下首个.本项目还支持侧滑出现menu ...