Chapters
Python114 chapters

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

{} 0

See also