Say I have the classic 4-byte signed integer, and I want something like
print hex(-1)
to give me something like
0xfffffff
Try this function:
'%#4x' % (-1 & 0xffffffff)