Python Dictionary clear() Method
Example
Remove all elements from the car
list:
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
car.clear()
print(car)
Run example »
Definition and Usage
The clear()
method removes all the elements from a
dictionary.
Syntax
dictionary.clear()
Parameter Values
No parameters