Question: Using an API, I am pulling information from a url, and keep getting an error. Needing to know how to fix the error I keep

Using an API, I am pulling information from a url, and keep getting an error. Needing to know how to fix the error I keep getting that states string indices must be integers in the following code:

import urllib.request import json link = "url" f = urllib.request.urlopen(link) data = f.read() print (str(data, 'utf-8')) weather = json.loads(data) print('/n') print(weather["name"]["temp"])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!