Traditional Culture Encyclopedia - Weather forecast - There is always an error in the code written in python to get the weather forecast. Solve it.
There is always an error in the code written in python to get the weather forecast. Solve it.
Weatherinfo=r.json() # Put parentheses after json to return the result. Otherwise, only the function address can be returned.
The following python3 passes:
Import? ask
API URL = "/adat/city info/ 10 10 10 100 . html "
r=requests.get(ApiUrl)
weatherinfo=r.json()
Print? (weather info[" weather info "][" ptime "])
Print? (weather info[" weather info "][" temp 2 "])& gt; & gt& gt Eight o'clock
& gt& gt& gt5℃
- Previous article:Places suitable for the elderly to travel.
- Next article:Flash event planning book
- Related articles
- What are you wearing in Shanghai now?
- Words describing snowy weather.
- Weather forecast in Seoul, South Korea
- Talking about the hot sauna in summer (27 selected sentences)
- What is the lowest temperature in Heze in winter?
- How many kilometers is it from Jia Road, Wuyuan, Jiangxi to Lutang, Xinyu City?
- Wudang mountain travel guide
- I'm from Datong, Shanxi, and I want to go to Qingdao with my family. Please help me introduce my itinerary.
- What are the poems that feel the coolness of autumn?
- What will the weather be like in Xi 'an, Shaanxi in the coming week?