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
Related examples in the same category