empty dictionary in python and replace code example Example 1: empty dictionary python dict_empty = {} Example 2: how to empty a dictionary in python dict.clear()