首页 > 其他 > 详细

iteritems()与items()

时间:2017-02-18 18:43:03      阅读:131      评论:0      收藏:0      [点我收藏+]

iteritems:以迭代器对象返回字典键值对

item:以列表形式返回字典键值对

>>> dic = {‘a‘:3,‘c‘:1,‘b‘:2}
>>> print dic.iteritems()
<dictionary-itemiterator object at 0x7fa381599628>
>>> print dic.items()
[(‘a‘, 3), (‘c‘, 1), (‘b‘, 2)]

 

iteritems()与items()

原文:http://www.cnblogs.com/ymjyqsx/p/6413741.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!