小编spe*_*hta的帖子

Python - 像对象这样的字节是必需的,而不是str

我正在将我的Twitch bot从Python 2.7移植到Python 3.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
Run Code Online (Sandbox Code Playgroud)

python irc python-3.x twitch

38
推荐指数
1
解决办法
6万
查看次数

标签 统计

irc ×1

python ×1

python-3.x ×1

twitch ×1