ReferenceDictionary methods
dict.clear()
Removes every pair, keeping the same object.
Signature
mapping.clear()Returns
None.
Example
Python
person = {"name": "Ada"}
person.clear()
print(person, len(person))Output
{} 0Basics
Strings
Collections
Functions
Classes and objects
Modules and the standard library
Files and errors
Beyond the basics
ReferenceDictionary methods
Removes every pair, keeping the same object.
mapping.clear()None.
person = {"name": "Ada"}
person.clear()
print(person, len(person))Output
{} 0