2024-09-30 06:21:06 发布
网友
我使用套接字从另一个系统返回了以下打印字节:
b"\x0bMessage Received!\r\x1c\r"
例如: print(b"\x0bMessage Received!\r\x1c\r".decode(encoding="utf-8"))
print(b"\x0bMessage Received!\r\x1c\r".decode(encoding="utf-8"))
我得到了一份工作
Can you help me to understand how to get an output like this Message Received!从该消息中删除
Message Received!
b"\x0bMessage Received!\r\x1c\r".decode("utf-8")
您需要去掉不需要的字符(在本例中为垂直制表符和回车符):
>>> bs = b"\x0bMessage Received!\r\x1c\r" >>> print(bs.decode().strip()) Message Received!
您需要去掉不需要的字符(在本例中为垂直制表符和回车符):
相关问题 更多 >
编程相关推荐