Update a dictionary : Dictionary update « Dictionary « Python






Update a dictionary

Update a dictionary

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

print d2                                       # order is scrambled

d3 = {'toast':4, 'muffin':5}

d2.update(d3)

print d2

           
       








Related examples in the same category

1.Dictionary update methodDictionary update method