from collections import defaultdict
# 默认值字典
dd = defaultdict(lambda: "胡辣汤") # callable 可调用的, 字典是空的 print(dd["张无忌"]) # 从字典向外拿数据. 字典是空的. key:callable() 这里的[]和get()不是一回事
print(dd.get("宝宝"))
print(dd) from collections import OrderedDict dic = OrderedDict()
dic["a"] = "哈哈"
dic["b"] = "呵呵"
print(dic) print(dic["a"])