Answer the question
In order to leave comments, you need to log in
How to solve IndexError: list index out of range error?
try:
if user_channel_status[70] != 'left':
print()
else:
await bot.send_message(message.chat.id, '')
except:
if user_channel_status[60] != 'left':
await bot.send_message(message.from_user.id, '')
else:
await bot.send_message(message.from_user.id, '')
await bot.answer_callback_query(call.id)
Answer the question
In order to leave comments, you need to log in
Obviously user_channel_status does not have elements with index 60 and 70. You can solve the problem by checking the length of the list.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question