Looping through dictionaries : Dictionary Loop : Dictionary PYTHON examples


PYTHON examples » Dictionary » Dictionary Loop »

 

Looping through dictionaries


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



           
         
  



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Dictionary
» Dictionary Loop