Home>Article>Backend Development> Python update function definition and action example analysis
In this article we will learn about thepython update functionin the python dictionary. What does theupdatefunction mean in thepython 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 example The 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 tutorialcolumn 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!