pyython how to call dict keys code example
Example 1: how to create a dictionary in python
thisdict = {
"key1" : "value1"
"key2" : "value2"
"key3" : "value3"
"key4" : "value4"
}
Example 2: dictionary in python
#A dictionary has key-value pairs. Here 1,2,3 are the keys and Item1,Item2,Item3
#are their values respectively.
dictionaryName = { 1: "Item1", 2: "Item2", 3: "Item3"}
#retrieving value of a particular key
dictionaryName[1]
#retrieving all the keys in a dictionary
dictionaryName.keys()
#retrieving all the values in a dictionary
dictionaryName.values()