Mega Code Archive

 
Categories / Python / 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