python3.x运行程序报错AttributeError: 'dict' object has no attribute 'iteritems'

python3.x中运行程序报错 AttributeError: 'dict' object has no attribute 'iteritems'

classCount={}   
classCount.iteritems()

原因:

{}.iteritems()是python2.x中的方法,python3.x中iteritems变为items,更改为

classCount={}   
classCount.items()

问题解决。

猜你喜欢

转载自blog.csdn.net/m511655654/article/details/83145726