China Naming Network - Fortune telling knowledge - The code written in python to obtain the weather forecast always has errors, please solve it
The code written in python to obtain the weather forecast always has errors, please solve it
weatherinfo=r.json() #Add parentheses after json to return the result. Otherwise, only the function address can be returned.
The following python3 passes: import?requests
ApiUrl="/adat/cityinfo/101010100.html"
r=requests.get(ApiUrl)
p>weatherinfo=r.json()
print?(weatherinfo["weatherinfo"]["ptime"])
print?(weatherinfo["weatherinfo"] ["temp2"])
>>>08:00
>>>5℃