YouTip LogoYouTip

Att Dictionary Update

# Python2.x Python Dictionary update() Method [![Image 3: Python Dictionary](#) Python Dictionary](#) * * * ## Description The Python Dictionary update() function updates the dictionary dict with the key/value pairs from dict2. ## Syntax The syntax for the update() method is: dict.update(dict2) ## Parameters * dict2 -- The dictionary to be added to the specified dictionary dict. ## Return Value This method does not return any value. ## Example The following example demonstrates the usage of the update() function: ## Example #!/usr/bin/python tinydict ={'Name': 'Zara','Age': 7} tinydict2 ={'Sex': 'female'} tinydict.update(tinydict2) print("Value : %s" % tinydict) The output of the above example is: Value : {'Age': 7, 'Name': 'Zara', 'Sex': 'female'} [![Image 4: Python Dictionary](#) Python Dictionary](#)
← Att Dictionary ValuesAtt Dictionary Setdefault β†’