Home > Article > Backend Development > Python update function definition and action example analysis
In this article we will learn about the python update function in the python dictionary. What does the update function mean in the python dictionary? , the function of this function will be answered in the following article.
python update function description
Python dictionary (Dictionary) update() function updates the key/value pairs of dictionary dict2 into dict.
Syntax
dict.update(dict2)
Parameters
Return value
This method does not have any return value. Python update function exampleThe following example shows how to use the update() function:#!/usr/bin/python dict = {'Name': 'Zara', 'Age': 7} dict2 = {'Sex': 'female' } dict.update(dict2) print "Value : %s" % dictThe output result of the above example is:
Value : {'Age': 7, 'Name': 'Zara', 'Sex': 'female'}The above is All that this article talks about is the built-in update function of the dictionary in Python. I hope what I said and the examples I gave can be helpful to you. For more related knowledge, please visit the
Python tutorial column on the php Chinese website.
The above is the detailed content of Python update function definition and action example analysis. For more information, please follow other related articles on the PHP Chinese website!