Removes all the elements from the dictionary.
clear()
Returns a copy of the dictionary.
copy()
Returns a dictionary with the specified keys and value.
fromkeys()
Returns the value of the specified key.
get()
Returns a list containing a tuple for each key value pair.
items()
Returns a list containing the dictionary’s keys.
keys()
Removes the element with the specified key.
pop()
Removes the last inserted key-value pair.
popitem()
Returns the value of the specified key. If the key does not exist: insert the key, with the specified value.
setdefault()
Updates the dictionary with the specified key-value pairs.
update()
car = {
"brand": "Ford"
}
car.update({"color": "White"})
# Output
{
"brand": "Ford",
"color": "White"
}Returns a list of all the values in the dictionary.
values()
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
car.values()
# Output
dict_values(['Ford', 'Mustang', 1964])