Skip to content
Advertisement

Iterate over Json with no list in python

I want to be able to iterate with the dictionary from Json that like how it is done with list.

JavaScript

Getting below error.

JavaScript

Expected:

Should be able to use any of the key values inside for loop to iterate for each of the univ# block. ie., each univ# should a an item in for loop so that I can perform some actions on any number of univ#

Advertisement

Answer

The json object is actually a dictionary, so instead of

JavaScript

You have write:

JavaScript

Or even better:

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