Python 如何在我的命令行中显示消息文本?

Python 如何在我的命令行中显示消息文本?,python,telegram,py-telegram-bot-api,Python,Telegram,Py Telegram Bot Api,我使用pytelegrambotapi库在telegram中创建我的bot 这是我的密码: import config import telebot bot = telebot.TeleBot(config.token) @bot.message_handler(commands=['start']) def handle_start_message(message): bot.send_message(message.chat.id, "Hello. I'm your

我使用pytelegrambotapi库在telegram中创建我的bot

这是我的密码:

import config
import telebot

bot = telebot.TeleBot(config.token)


@bot.message_handler(commands=['start'])
def handle_start_message(message):
    bot.send_message(message.chat.id, "Hello. I'm your bot")
    print(message.text)

我要做的是在命令行中返回消息文本。它什么也不返回,但是,机器人正在工作,因为它在电报中回答我。

最可能的情况是,代码在单独的进程/进程中运行,无法访问控制台,因此无法打印其中的内容

使用日志记录文件而不是打印


这里有一个有用的链接-

thx,但实际上我使用print仅表示bot接收的消息可能会影响某些局部变量。比如:if message.text==“hello”:local_var=1您是否尝试过python
logging
module?