Answer the question
In order to leave comments, you need to log in
What is the problem with this error?
This error pops up:
ValueError: invalid literal for int with base 10 '79999999999 4'
def get_number(message):
if int(message.text):
try:
if len(int(message.text)) == "13":
haha = int(message.text)[12:]
if haha < 5:
bot.send_message(message.chat.id, '<b>✉️Началось</b>', parse_mode='HTML')
if len(int(message.text)) == "14":
haha = int(message.text)[13:]
if haha < 5:
bot.send_message(message.chat.id, '<b>✉️Началось</b>', parse_mode='HTML')
except:
bot.send_message(message.chat.id, 'Произошла ошибка!', reply_markup=home)
Answer the question
In order to leave comments, you need to log in
You have a string '79999999999 4' that you are trying to convert to int:
int('79999999999 4')
You can, for example, remove the space character in this string:
s = '79999999999 4'
s = s.replace(' ', ' ')
int(s)
But then you also have invalid code:
int(message.text)[12:]
An int cannot be sliced `[12:]`
In spaces - in spaces in lines, in spaces of knowledge of python
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question