Answer the question
In order to leave comments, you need to log in
This error pops up IndentationError: unindent does not match any outer indentation level, solve it in my code and what is the problem?
@bot.message_handler(content_types=['text'])
def start_message(message):
chatld = message.chat.id
text = message.text.lower()
print(text)
if text == 'monday_1' :
m1 = open('photo01.jpg', 'rb')
bot.send_photo(chatld, m1)
if text == 'monday_2':
m2 = open('photo02.jpg', 'rb')
bot.send_photo(chatld, m2)
Answer the question
In order to leave comments, you need to log in
You have tabs in the indents, then spaces. For Python, this is critical. Read in any book for dummies. Moreover, the answer to your question can be googled on the first try on any iron.
Format the code before publishing with the appropriate tags. In this case, all questions would immediately disappear from you.
Throw off the code in a special tag, it looks like you have an indentation error. And why is the chatid variable needed?
@bot.message_handler(content_types=['text'])
def start_message(message):
text = message.text.lower()
print(text)
if text == 'monday_1' :
m1 = open('photo01.jpg', 'rb')
bot.send_photo(message.chat.id, m1)
if text == 'monday_2':
m2 = open('photo02.jpg', 'rb')
bot.send_photo(message.chat.id, m2)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question