📅  最后修改于: 2022-03-11 14:45:55.637000             🧑  作者: Mango
import collections
a_dict = collections.defaultdict(list) # a dictionary key --> list (of any stuff)
a_dict["a"].append("hello")
print(a_dict)
>>> defaultdict(, {'a': ['hello']})
a_dict["a"].append("kite")
print(a_dict)
>>> defaultdict(, {'a': ['hello', 'kite']})