Python-需要一个像字节一样的对象,而不是

2024-06-10 20:59:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在将Twitch机器人从Python2.7移到Python3.5。我不断地发现错误: a bytes like object is required not 'str'在下面代码的第二行。

twitchdata = irc.recv(1204)
    data = twitchdata.split(":")[1]
    twitchuser = data.split("!")[0]
    twitchmsg = twitchdata.split(":")[2]
    chat = str(twitchuser) +": "+ str(twitchmsg)
    print(chat) #prints chat to console

Tags: databytesobjectischatrequirednot机器人