Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add key to dictionary python

d = {'key': 'value'}
print(d)
# {'key': 'value'}
d['mynewkey'] = 'mynewvalue'
print(d)
# {'key': 'value', 'mynewkey': 'mynewvalue'}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #key #dictionary #python
ADD COMMENT
Topic
Name
8+3 =