Answers for "add dict key and value to dict from a method in python"

52

add new keys to a dictionary python

d = {'key':'value'}
print(d)
# {'key': 'value'}
d['mynewkey'] = 'mynewvalue'
print(d)
# {'mynewkey': 'mynewvalue', 'key': 'value'}
Posted by: Guest on November-27-2019
4

python dictionary add key-value pair

dict = {'key1':'value_one', 'key2':'value_two'}  
dict['key3'] = 'value_three'
Posted by: Guest on September-21-2020

Code answers related to "add dict key and value to dict from a method in python"

Python Answers by Framework

Browse Popular Code Answers by Language