2024-05-18 11:41:33 发布
网友
我明白了:
_format_ = "7c7sc" print struct.unpack(self._format_, data)
给予
('\x7f', 'E', 'L', 'F', '\x01', '\x01', '\x01', '\x00\x00\x00\x00\x00\x00\x00', '\x00')
我想取'\x01'并从中得到1,即转换成``int。有什么想法吗? 谢谢
'\x01'
也许您正在考虑ord函数?
ord
>>> ord("\x01") 1 >>> ord("\x02") 2 >>> ord("\x7f") 127
ord("\x01")将返回1。
ord("\x01")
也许您正在考虑
ord
函数?ord("\x01")
将返回1。相关问题 更多 >
编程相关推荐