删除字典内所有元素。
dict.clear()
def test(): arr={"key1":1,"key2":2,"key3":3} print(arr) # 输出:{"key1":1,"key2":2,"key3":3} # 执行清空 arr.clear() print(arr) # 输出:{}