python模块之默认值字典
from collections import defaultdict, OrderedDict
# 给字典设置一个默认值
dd = defaultdict(lambda: '喰种') # 必须是callable的,可调用的 这个字典是空的
print(dd['金木研'])
print(dd)
# 设置一个有序字典(主要是字典在python3.5之前是无序的)
from collections import OrderedDict
dic = OrderedDict()
dic['a'] = '金木研'
dic['b'] = '神代利世'
print(dic)
print(dic.get('a'))
print(dic.values())
print(dic['b'])