目标 想要获取一个整形数字的二进制表示 bin 内置函数 看一下官方的解释 Convert an integer number to a binary string prefixed with "0b". The result is a valid Python expression. If x is not a Python int object, it has to define an index() method that returns an integer. Some exa…
#coding=utf- from struct import pack,unpack byte=pack('f',1.5) print(byte) print([i for i in byte]) byte=pack('f',123432.523424) print(byte) print([i for i in byte]) 输出 ?? ['\x00', '\x00', '\xc0', '?'] C?G ['C', '\x14', '\xf1', 'G']…