返回顶部

收藏

Looping through dictionaries

更多
#the key and corresponding value can be retrieved at the same time using the 
#iteritems() method.

knights = {'Key 1': 'value 1', 'key 2': 'value 2'}
for k, v in knights.iteritems():
     print k, v

标签:Python,Dictionary

收藏

0人收藏

支持

0

反对

0

发表评论