【发布时间】:2015-06-21 00:28:02
【问题描述】:
我正在将我的 Twitch 机器人从 Python 2.7 迁移到 Python 3.5。我不断收到错误:
a bytes like object is required not 'str' 在下面代码的第 2 行。
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
【问题讨论】:
-
参见:Ned Batcheler 的Pragmatic Unicode, or, How Do I Stop the Pain?
标签: python python-3.x irc twitch