📅  最后修改于: 2022-03-11 14:45:17.145000             🧑  作者: Mango
from collections import defaultdict
d_int = defaultdict(int)
d_list = defaultdict(list)
def foo():
return 'default value'
d_foo = defaultdict(foo)
>>> d_int
defaultdict(, {})
>>> d_list
defaultdict(, {})
>>> d_foo
defaultdict(, {})