How to put a variable in bot.sendMesage (python)

2k views Asked by At

I'm creating a telegram bot with python and I can't find the way to make the output of a variable with bot.sendMessage. Can anyone help me please?

var = '123'
bot.sendMessage(chat_id, "The number is:"var)
1

There are 1 answers

0
91DarioDev On BEST ANSWER

This is a python syntax error. You are not concatenating. You can do this for example (but you can use also other ways to concatenate):

var = '123'
bot.sendMessage(chat_id, "The number is:{}".format(var))