Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python add to dictionary

# Basic syntax:
dictionary['new_key'] = 'new_value'

# Example usage:
d = {'a': 1, 'b': 5} # Define dictionary
d['c'] = 37 # Add a new key to the dictionary
print(d)
--> {'a': 1, 'b': 5, 'c': 37}
Source by www.journaldev.com #
 
PREVIOUS NEXT
Tagged: #python #add #dictionary
ADD COMMENT
Topic
Name
4+4 =