Python 强制使用Unicode:需要字符串或缓冲区,找到元组。有人吗? while(i
这是由于您未在此处共享的行中出现错误,或者可能是您正在使用的代码中的打字错误(但最终在此处共享时已更正)。正如错误消息所述,问题在于行:Python 强制使用Unicode:需要字符串或缓冲区,找到元组。有人吗? while(i,python,unicode,Python,Unicode,这是由于您未在此处共享的行中出现错误,或者可能是您正在使用的代码中的打字错误(但最终在此处共享时已更正)。正如错误消息所述,问题在于行: File "cliente.py", line 43, in <module> udp1.sendto("toc,toc"+ (host,int(puerto_actual))) TypeError: cannot concatenate 'str' and 'tuple' objects 这里的“toc,toc”+表示您希望将str与元组
File "cliente.py", line 43, in <module>
udp1.sendto("toc,toc"+ (host,int(puerto_actual)))
TypeError: cannot concatenate 'str' and 'tuple' objects
这里的
“toc,toc”+
表示您希望将str
与元组对象(主机,int(波多黎各实际值))连接起来
这不是一个有效的操作。为了解决这个问题,用逗号替换+
,udp1.sendto需要多少个参数?似乎您提出了错误的代码-错误显示没有“toc,toc”+(主机,int(波多黎各实际值)
。或者您运行的代码与您想象的不同。
File "cliente.py", line 43, in <module>
udp1.sendto("toc,toc"+ (host,int(puerto_actual)))
TypeError: cannot concatenate 'str' and 'tuple' objects
udp1.sendto("toc,toc"+ (host,int(puerto_actual)))
# ^ replace with ,