【发布时间】:2014-05-13 06:32:32
【问题描述】:
在 Python 中,我需要将一堆浮点数转换为十六进制。它需要补零(例如,0x00000010 而不是 0x10)。就像http://gregstoll.dyndns.org/~gregstoll/floattohex/ 一样。 (遗憾的是我不能在我的平台上使用外部库,所以我不能使用该网站上提供的库)
最有效的方法是什么?
【问题讨论】:
-
使用
struct,然后提取字节。
标签: python python-2.7 floating-point-conversion