python key value dictionary code example
Example 1: dict value python
obj = {0:"hello", 1:"there"}
print(obj[0])
print(obj[1])
print("\n\n\n\n\n")
for i in range(len(obj)):
print(obj[i])
Example 2: how to get element from dictionary python
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
dict['Age'] = 8;
dict['School'] = "DPS School";
print "dict['Age']: ", dict['Age']
print "dict['School']: ", dict['School']
Example 3: dictionary in python
dictionaryName = { 1: "Item1", 2: "Item2", 3: "Item3"}
dictionaryName[1]
dictionaryName.keys()
dictionaryName.values()