1、
>>> test1 = dict(key1="aaa",key2="bbb",key3="ccc",key4="ddd")
>>> test1
{'key1': 'aaa', 'key2': 'bbb', 'key3': 'ccc', 'key4': 'ddd'}
>>> del test1["key2"]
>>> test1
{'key1': 'aaa', 'key3': 'ccc', 'key4': 'ddd'}
>>> del test1["key1"]
>>> test1
{'key3': 'ccc', 'key4': 'ddd'}
2、
>>> test1 = dict(key1="aaa",key2="bbb",key3="ccc",key4="ddd")
>>> test1
{'key1': 'aaa', 'key2': 'bbb', 'key3': 'ccc', 'key4': 'ddd'}
>>> test1.pop("key2")
'bbb'
>>> test1
{'key1': 'aaa', 'key3': 'ccc', 'key4': 'ddd'}
>>> test1.pop("key3")
'ccc'
>>> test1
{'key1': 'aaa', 'key4': 'ddd'}
>>> test1.popitem()
('key4', 'ddd')
>>> test1
{'key1': 'aaa'}