【发布时间】:2022-11-29 18:31:37
【问题描述】:
字符串就像“e52c886a88b6f421a9324ea175dc281478f03003499de6162ca72ddacf4b09e0”,当我运行代码时,输出不是我的预期,像这样。
hexstr = "e52c886a88b6f421a9324ea175dc281478f03003499de6162ca72ddacf4b09e0"
hexstr = bytes.fromhex(hexstr)
print(hexstr)
输出是
b'\xe5,\x88j\x88\xb6\xf4!\xa92N\xa1u\xdc(\x14x\xf00\x03I\x9d\xe6\x16,\xa7-\xda\xcfK\t\xe0'
我的预期输出应该像 b'\xe5\x2c\xc8\x86 ......
【问题讨论】:
标签: python python-3.x python-2.7 hex byte