Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python dictonary of dictonary

from collections import defaultdict
d = defaultdict(dict)
d['dict1']['innerkey'] = 'value'

>>> d  # currently a defaultdict type
defaultdict(<type 'dict'>, {'dict1': {'innerkey': 'value'}})
>>> dict(d)  # but is exactly like a normal dictionary.
{'dict1': {'innerkey': 'value'}}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #dictonary #dictonary
ADD COMMENT
Topic
Name
9+2 =