This class method remove all items from the dictionary.
dict.clear()
#!/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
Advertisement