The clear method
The clear
method removes all elements from the dictionary. We do not specify anything in the method parameter.
Syntax
dictionary.clear()
Example
Let's remove all the elements in our dictionary:
dct = {
'a': 1,
'b': 2,
'c': 3
}
dct.clear()
print(dct)
Result of code execution:
{}