For example, if we take 1 and transform it to unsigned 32-bits, it will be 00000000000000000000000000000001
How could you achieve this in python?
def convert(i):
return int(bin(i+2**32)[-32:])
print convert(1)
print convert(32)
print convert(100)
print convert(-1)
print type(convert(1))
outputs
00000000000000000000000000000001
00000000000000000000000000100000
00000000000000000000000001100100
11111111111111111111111111111111
<type 'long'>
bin(1)[2:].zfill(32)
'00000000000000000000000000000001'
"{:032b}".format(1)?