I have an integer containing four ASCII codes for four chars:
0x31323334
I need to convert this integer to a string:
"1234" ~ "\x31\x32\x33\x34"
Is there better solution than this?
mystring = '%0*x' % (8, 0x31323334) # "31323334"
mystring.decode('hex') # "1234"
str('0x31323334')[2:].decode('hex')as I think it's more readable, but the basic idea is the same.hex(0x31323334)[2:].decode('hex')?