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 copy() Method


previous next AddThis Social Bookmark Button


Description:

This class method returns a shallow copy of the dictionary.

Syntax:

dict.copy()

Example:

#!/usr/bin/python

dict1 = {'Name': 'Zara', 'Age': 7};

dict2 = dict1.copy()
print "New Dictinary : %s" %  str(dict2)

This produces following result:

New Dictinary : {'Age': 7, 'Name': 'Zara'}


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names