在创建我自己的电报机器人时,我遇到了一个错误
File "c:\Users\Кирилл\Desktop\python_bot — копия\main_part.py", line 7
bot.polling(none_stop=True, interval=0)
^
SyntaxError: invalid syntax代码部分:
bot = TeleBot('ToKeN')
@bot.message_handler(content_types=['text'])
bot.polling(none_stop=True, interval=0)发布于 2020-04-27 04:39:25
也许是@bot.message_handler(content_types=['text'])中的@导致了这个错误。
删除@,然后重试。
发布于 2020-06-15 22:20:26
在@...之后您应该像这样输入一个方法:
@bot.message_handler(commands=['hello'])
def handler(message):
bot.reply_to(message,'hello!'https://stackoverflow.com/questions/61447736
复制相似问题