Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API-Call, Json und und Pygal
#7
(Sep-04-2019, 08:16 AM)buran Wrote:
(Sep-04-2019, 08:09 AM)starter_student Wrote: what is wring with my code
the way you try to access different parts in the JSON object, e.g.
for city in data["list"]:
    cities.append(city["list"][1]["name"])
you loop over each element in data['list']. That is each city data being dict. Then you try to access city['list'] - there is no such key within city dict. Then you even try (not sure what) to use index as in list i.e. [1] or key=1 as in dict with int keys... again - city is not a list, nor there is key=1 in city dict

same apply to part where you try to get temps


got it!. Thks
Reply


Messages In This Thread
API-Call, Json und und Pygal - by starter_student - Sep-03-2019, 03:41 PM
RE: API-Call, Json und und Pygal - by buran - Sep-03-2019, 03:59 PM
RE: API-Call, Json und und Pygal - by buran - Sep-04-2019, 07:59 AM
RE: API-Call, Json und und Pygal - by buran - Sep-04-2019, 08:16 AM
RE: API-Call, Json und und Pygal - by starter_student - Sep-04-2019, 08:24 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020