Delete dictionary entry : Dictionary Del « Dictionary « Python






Delete dictionary entry

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

print d2                                       # order is scrambled

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

del d2['eggs']                            # delete entry

print d2

           
       








Related examples in the same category