>>> from collections import defaultdict>>> a = defaultdict(dict)>>> a['hell']['good']= 1>>> adefaultdict(<class 'dict'>, {'hell': {'good': 1}})
来源: http://www.bubuko.com/infodetail-2532953.html