首页 > 解决方案 > 如何从 HexBytes 对象中获取十六进制字符串?

问题描述

>>> from hexbytes import HexBytes
>>> ...
>>> hb
HexBytes('0x53b983fe73e16f6ed8178f6c0e0b91f23dc9dad4cb30d0831f178')

我有一个 HexBytes 对象hb,我想得到 '0x53b983fe73e16f6ed8178f6c0e0b91f23dc9dad4cb30d0831f178' 字符串,我该怎么办?

标签: pythonweb3

解决方案


你可以只输入hb.hex(),它应该可以工作


推荐阅读