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


previous next AddThis Social Bookmark Button


Description:

This class method remove all items from the dictionary.

Syntax:

dict.clear()

Example:

#!/usr/bin/python

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

print "Start Len : %d" %  len(dict)
dict.clear()
print "End Len : %d" %  len(dict)

This produces following result:

Start Len : 2
End Len : 0


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names