I have a dict of nested dicts and key-values.
dicta = {'key1': {'keya': 'a', 'keyb': 'b'},
'key2': {'key3':{'keyc': 'c'}}, 'key4': 4}}
Is there a way I can use a for loop to get to 'c'?
I tried,
print(dicta['key2'])
for x in dicta['key2']:
for y in x['key3']:
print(y)
For the first print, I get
{'key3': {'keyc': 'c'}}
But I get TypeError: string indices must be integers for the second print.
Thanks in advance! *I edited replacing n with dicta; I copied and pasted it wrong the first time.