Dictionary update method : Dictionary update « Dictionary « Python






Dictionary update method

Dictionary update method
#The update method updates one dictionary with the items of another:

d = {   'title': 'Python Web Site',
        'url': 'http://www.python.org',
        'changed': '3. august 2001 21:08:05 GMT'
    }
x = {'title': 'Python Language Website'}
d.update(x)
print d

#The items in the supplied dictionary are added to the old one, overwriting any items 
#there with the same keys.
           
       








Related examples in the same category

1.Update a dictionaryUpdate a dictionary