I have following nested dictionary
nested_dictionary = {
"api": {
"results": 4,
"leagues": {
"22": {
"league_id": "22",
"name": "Ligue 1",
"country": "France",
"season": "2017",
"season_start": "2017-08-04",
"season_end": "2018-05-19",
"logo": "https://www.api-football.com/public/leagues/22.svg",
"standings": True
},
"24": {
"league_id": "24",
"name": "Ligue 2",
"country": "France",
"season": "2017",
"season_start": "2017-07-28",
"season_end": "2018-05-11",
"logo": "https://www.api-football.com/public/leagues/24.png",
"standings": True
},
"157": {
"league_id": "157",
"name": "National",
"country": "France",
"season": "2017",
"season_start": "2017-08-04",
"season_end": "2018-05-11",
"logo": "https://www.api-football.com/public/leagues/157.png",
"standings": True
},
"206": {
"league_id": "206",
"name": "Feminine Division 1",
"country": "France",
"season": "2017",
"season_start": "2017-09-03",
"season_end": "2018-05-27",
"logo": "https://www.api-football.com/public/leagues/206.png",
"standings": True
}
}
}
}
i convert it to iterable with following code
dict_to_iterable = iter(nested_dictionary)
Now i am trying to iter it with following code
print(next(dict_to_iterable))
print(next(dict_to_iterable))
First statement return api but second give in console StopIteration. What i am doing wrong. Please help me