-
先看代码:
-
# 1. 收数据,然后打印
def recvData():
while True:
recvInfo = udpSocket.recvfrom(1024)
# str(xxx,"utf-8") 转码
print(">> %s:%s" % (str(recvInfo[1]), str(recvInfo[0],"utf-8")))
-
python3使用str(s, 'utf8') python2使用 s.decode('utf8')来解码
-
这样就能输出汉字
python转码解码
最新推荐文章于 2023-09-08 10:13:45 发布