0

我制作了一个单词随机化器,它适用于 txt 单词文件。但是机器人以错误的编码发送消息,当它应该是“обря​​дник”时,我会收到“РѕР±СЂСЏРґРЅРёРє”。如何解决?

编码:

with open("C:\\Users\\User\\Desktop\\russian_nouns.txt") as f:
    lines = f.read().splitlines()

@bot.on_message(filters.command('rng') & filters.private)
def command(bot, message):
    word = random.choice(lines)

    bot.send_message(message.chat.id, word)
4

0 回答 0