Dictionary for loop : Dictionary Loop « Dictionary « Python






Dictionary for loop

Dictionary for loop
 
dict = {'x': 1, 'y': 2, 'z': 3}
for key in dict:
    print key, 'corresponds to', dict[key]


           
         
  








Related examples in the same category

1.Looping through dictionariesLooping through dictionaries
2.for each loop with dictionary