Вставка данных из JSON в bot.send_message
У меня есть JSON который я разбираю и получаю нужные мне данные
data = response.json()
for d in data:
adress = d['adress']
starttime = d['starttime']
Как мне эти данные вставить в bot.send_message? Текст можно вставить так
bot.send_message(c.message.chat.id, 'Текст')
Но как вместо 'Текст' вставить adress = d['adress'] и starttime = d['starttime']
Ответы (1 шт):
Автор решения: MyZik
→ Ссылка
data = response.json()
for d in data:
adress = d['adress']
starttime = d['starttime']
text = f"Address: {adress}\n Starttime: {starttime}"
bot.send_message(c.message.chat.id, text)