convert decimal float to binary python code example
Example 1: how to convert decimal to binary python
a = 5
#this prints the value of "a" in binary
print(bin(a))
Example 2: python converting float to binary
import bitstring
f1 = bitstring.BitArray(float=1.0, length=32)
print(f1.bin)