I'm creating a 8-bits number with numpy:
a = numpy.uint8(2)
and сall :
bin(a)
Result : ob10 ,but I want to have a representation where all bits of my numbers filled : 00000010
I'm creating a 8-bits number with numpy:
a = numpy.uint8(2)
and сall :
bin(a)
Result : ob10 ,but I want to have a representation where all bits of my numbers filled : 00000010
use this function
def getBits(a):
binary=bin(a)
zeros_required=8-(len(binary)-2)
return '0'*zeros_required+binary[2:]