📅  最后修改于: 2022-03-11 14:45:24.805000             🧑  作者: Mango
# setdefault will insert key with a value of default
# get will not insert key
a = {}
b = a.get('key','value')
print(a,b)
# {} value
a = {}
b = a.setdefault('key','value')
print(a,b)
# {'key': 'value'} value