SoFunction
Updated on 2024-11-19

Example analysis of basic python dictionary operations

This article example describes basic python dictionary operations. Shared for your reference. Specific as follows:

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
d2['brunch'] = 'Bacon' # add new entry
print d2

I hope that what I have described in this article will help you in your Python programming.