Looping through dictionaries







#the key and corresponding value can be retrieved at the same time using the 

#iteritems() method.



knights = {‘Ke1‘: ’value 1‘, ’ke2‘: ’value 2‘}

for k, v in knights.iteritems():

     print k, v







           

       

Tags: , , , , ,

Leave a Reply