erase dictionary python code example Example 1: remove element from dictionary python dict.pop("key") Example 2: how to empty a dictionary in python dict.clear()