【发布时间】:2018-05-20 07:14:23
【问题描述】:
我正在使用 Python 3,但在将格式从字符串转换为字节时在服务器日志中发现了此错误
b'\x00\x01_\x97'.decode()
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
b'\x00\x01_\x97'.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x97 in position 3: invalid start byte
如何将字符串转换为其字节值?我
【问题讨论】:
-
你用的是哪个版本的python?
-
它的 Python 3.6.3
-
你的输出应该是怎样的?属于哪一种?
-
我想从这行数据中删除 b''
-
使用“utf-8”或“utf-16”的编码是什么?
标签: python hex typeconverter