在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'的更多相关文章

  1. facenet pyhton3.5 训练 train_softmax.py 时报错AttributeError: 'dict' object has no attribute 'iteritems'

    报错原因:在进行facenet进行train_softmax.py训练时,在一轮训练结束进行验证时,报错AttributeError: 'dict' object has no attribute ' ...

  2. 机器学习实战:KNN代码报错“AttributeError: 'dict' object has no attribute 'iteritems'”

    报错代码: sortedClassCount = sorted(classCount.iteritems(), key=operator.itemgetter(1), reverse=True) 解决 ...

  3. AttributeError: 'dict' object has no attribute 'has_key'

    运行下面的代码: if (locals().has_key('data')): del data gc.collect() 出错: if (locals().has_key('data')): Att ...

  4. celery:Unrecoverable error: AttributeError("'unicode' object has no attribute 'iteritems')

    环境描述 python2+django1.9下使用celery异步处理耗时请求. celery使用的是celery-with-redis这个第三方库,版本号为3.0. pip install cele ...

  5. AttributeError: 'dict' object has no attribute 'encode'

    首先这是一个很简单的 运行时错误: 错误分析: AttributeError:属性错误,造成这种错误的原因可能有: 你尝试访问一个不存在的属性或方法.检查一下拼写!你可以使用内建函数 dir 来列出存 ...

  6. flask 表单填充数据报错!AttributeError: 'dict' object has no attribute 'getlist'

    报错信息: AttributeError: 'dict' object has no attribute 'getlist' 解决: 虽然是小毛病,不得不说还是自己太粗心大意了.

  7. AttributeError: 'dict' object has no attribute 'status_code'

    前端AJAX请求数据,提示错误:“AttributeError: 'dict' object has no attribute 'status_code'”. 原因:是提示返回对象dict没有“sta ...

  8. 'dict' object has no attribute 'a'

    a = {} #a.a = 'a' #AttributeError: 'dict' object has no attribute 'a' #a['a'] #KeyError: 'a' a['a'] ...

  9. Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法

    最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...

随机推荐

  1. 【JAVA】POI设置EXCEL单元格格式为文本、小数、百分比、货币、日期、科学计数法和中文大写

    POI设置EXCEL单元格格式为文本.小数.百分比.货币.日期.科学计数法和中文大写 博客分类:,本文内容转自 http://javacrazyer.iteye.com/blog/894850 FIL ...

  2. 转载:Bootstrap 源码解析

    Bootstrap 源码解析 前言 Bootstrap 是个CSS库,简单,高效.很多都可以忘记了再去网站查.但是有一些核心的东西需要弄懂.个人认为弄懂了这些应该就算是会了.源码看一波. 栅格系统 所 ...

  3. hadoop的client搭建-即集群外主机访问hadoop

    1增加主机映射(与namenode的映射一样): 增加最后一行  [root@localhost ~]# su - root1 [root@localhost ~]# vi /etc/hosts 12 ...

  4. hasattr getattr setattr delattr --> (反射)

    class Room: def __init__(self,name): self.name = name def big_room(self): print('bigroot') R = Room( ...

  5. 玩转音频、视频的利器:FFmpeg

    导语 当下直播平台发展十分迅猛,依靠游戏内直播平台的发展带动游戏活跃提升收入,那么对于我们开发来说如何玩转视频呢?下面就来介绍一个音频.视频处理利器——FFmpeg. FFmpeg 简介 FFmpeg ...

  6. KMPlayer 一打开总是出现右面的窗口 导航区 怎样设置不会自动打开

    两步骤第一,右键-外观-标致-管理 删除默认标致 第二,打开hosts文件,位置在 C:\Windows\System32\drivers\etc 在最下面一行加入 127.0.0.1 player. ...

  7. 配置tomcat的开发环境

    第一步:鼠标右键计算机->属性->高级系统设置,进去之后,点击环境变量,如下图所示: 第二步:开始配置tomcat的环境变量,新建系统变量名CATALINA_BASE,值tomcat的安装 ...

  8. unity 向量赋值 传引用?传值?

    unity中,Vector2.Vector3之间的任意赋值都是传值 Vector2 v1; ,); v1=v2; v2.x=; Debug.Log(v1);//output: (2.0, 2.0) D ...

  9. Unity 平台依赖编译

    位置:unity文档-Manual-Scripting-Platform dependent compilation Property: Function: UNITY_EDITOR #define ...

  10. Javascript中call、apply之我见

    一.call和apply定义. 1.Call 语法:call([thisObj[,arg1[, arg2[, [,.argN]]]]]) 参数 thisObj 可选项.将被用作当前对象的对象. arg ...