Tutorials Point


  Python Basics
  Python Advanced
  Python Useful References
  Python Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Python dictionary update() Method


previous next AddThis Social Bookmark Button


Description:

This class method adds dictionary dict2's key-values pairs in to dict. This function does not return anything.

Syntax:

dict.update(dict2)

Parameters:

Here is the detail of parameters:

  • dict2: This is the dictionary to be added into dict.

Example:

#!/usr/bin/python

dict = {'Name': 'Zara', 'Age': 7}
dict2 = {'Sex': 'female' }

dict.update(dict2)
print "Value : %s" %  dict

This produces following result:

Value : {'Age': 7, 'Name': 'Zara', 'Sex': 'female'}


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names