标签: python int hex bits
编辑: 通过从float中搜索get int位解决了这个问题,然后在int值周围使用了hex()方法。效果很好。
import struct def floatToBits(f): s = struct.pack('>f', f) return struct.unpack('>l', s)[0] print(hex(floatToBits(501.0)))
我认为有人已经发布了类似下面的内容作为评论,谢谢!