Skip to content
Advertisement

Python: cannot get a value from nested dict

I am trying to loop over array of dicts and create a new dict using a for loop:

data

JavaScript

for loop:

JavaScript

And when I print src_roles_dict, I get an empty dict {}

Is there something I am missing? Sorry, coming from golang background.

Advertisement

Answer

JavaScript

Output

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement