python 函数学习

print dic.items() #[('a', 'hello'), ('c', 'you'), ('b', 'how')]

print dic.iteritems() #<dictionary-itemiterator object at 0x020E9A50>

深究:iteritor是迭代器的意思,一次反悔一个数据项,直到没有为止

for i in dic.iteritems():
  print i
结果:('a', 'hello')
('c', 'you')
('b', 'how')

原文地址:https://www.cnblogs.com/ncut/p/7268437.html