1. 程式人生 > >python: 字典嵌套

python: 字典嵌套

python

字典的嵌套:

>>> from collections import defaultdict
>>> a = defaultdict(dict)
>>> a[‘hell‘][‘good‘]= 1
>>> a
defaultdict(<class ‘dict‘>, {‘hell‘: {‘good‘: 1}})

python: 字典嵌套