Change dictionary entry : Dictionary Assignment « Dictionary « Python






Change dictionary entry

Change dictionary entry
 
d2 = {'spam': 2, 'ham': 1, 'eggs': 3}    # make a dictionary

print d2                                 # order is scrambled

d2['ham'] = ['grill', 'bake', 'fry']      # change entry

print d2


           
         
  








Related examples in the same category

1.Dictionary assignmentDictionary assignment
2.enter all the data for dict3 at the same time
3.Add new entry to a dictionaryAdd new entry to a dictionary