python3里面dict没有iteritems了,该用什么替换呢? >>> a = dict()
>>> a
{}
>>> a.iteritems()
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'iteritems'
>>>
python2里面的iteritems不占用额外内存,返回的是一个可迭代对象;而items返回的是dict的副本,占用内存。
在python3里面直接废弃了items的功能,在dict.items直接返回可迭代对象,所以可以在3里面直接用items代替2里面的iteritems即可。