Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python update multiple dictionary values

# Basic syntax:
your_dictionary.update({'keys':23, 'to':42, 'update':17})

# Example usage:
your_dictionary = {'keys':0, 'to':0}
your_dictionary.update({'keys':23, 'to':42, 'update':17})
print(your_dictionary)
--> {'keys': 23, 'to': 42, 'update': 17}
# Note, along with updating existing key values, the .update() method
#	adds keys to the dictionary if they aren't present
Source by thispointer.com #
 
PREVIOUS NEXT
Tagged: #python #update #multiple #dictionary #values
ADD COMMENT
Topic
Name
1+2 =