how to add key value pair to a dictionary in python code example
Example 1: python dictionary add key-value pair
dict = {'key1':'value_one', 'key2':'value_two'}
dict['key3'] = 'value_three'
Example 2: add key to dictionary python
d = {'key': 'value'}
print(d)
# {'key': 'value'}
d['mynewkey'] = 'mynewvalue'
print(d)
# {'key': 'value', 'mynewkey': 'mynewvalue'}