Create a dictionary and fetch value by key : Dictionary Fetch « Dictionary « Python






Create a dictionary and fetch value by key

Create a dictionary and fetch value by key
d2 = {'spam': 2, 'ham': 1, 'eggs': 3}    # make a dictionary
print d2['spam']                               # fetch value by key


           
       

Related examples in the same category