Python Dictionary clear() Method
Example
Remove all elements from the car
list:
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
car.clear()
print(car)
Try it Yourself »
Definition and Usage
The clear()
method removes all the elements from a
dictionary.
Syntax
dictionary.clear()
Parameter Values
No parameters
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.