@DavidDavidrrrr

Как достать temp_C?

Вот код
import telebot,requests
import json
response = requests.get("api.worldweatheronline.com/premium/v1/weather.ashx...")
r = response.json()["data"]

#print(r)
f=(r['current_condition'])
c=(f['temp_C'])

bot = telebot.TeleBot('1883463577:AAFKIw7nBzKvQ_0N9iUaL5l92ehX5gZmH5E')
@bot.message_handler(commands=['pogoda'])
def start_command(message):
print(f)
bot.send_message(message.chat.id,f)
bot.polling()
  • Вопрос задан
  • 83 просмотра
Пригласить эксперта
Ответы на вопрос 1
ramzis
@ramzis
FullStackOverflow
import requests
r = requests.get('http://api.worldweatheronline.com/premium\
                    /v1/weather.ashx?key=784a62fa7ebe4e4b89a65727211606&q=48.85,2.35&\
                    num_of_days=2&tp=3&format=json').json()
print(r['data']['current_condition'][0]['temp_C'])
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы