Попробуйте это:
import struct
getBin = lambda x: x > 0 and str(bin(x))[2:] or "-" + str(bin(x))[3:]
def floatToBinary32(value):
val = struct.unpack('I', struct.pack('f', value))[0]
return getBin(val)
binstr = floatToBinary32(42.0)
print('Binary equivalent of 42.0:')
print(binstr + '\n')