Answers for "python dictionaries of dictionaries"

2

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'}}
Posted by: Guest on August-22-2021
-1

dictionaries in python

# Creating a Nested Dictionary
# as shown in the below image
Dict = {1: 'Geeks', 2: 'For',
        3:{'A' : 'Welcome', 'B' : 'To', 'C' : 'Geeks'}}
 
print(Dict)
Posted by: Guest on February-25-2022

Code answers related to "python dictionaries of dictionaries"

Python Answers by Framework

Browse Popular Code Answers by Language