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