Using Python,
h = 0x11012
# ... ???
result = '11012'
What intermediary steps do I have to take to go from h -> result?
Python 2.7 and later:
>>> "{:x}".format(0x11012)
'11012'
Python 2.6:
>>> "{0:x}".format(0x11012)
'11012'
Python 2.5 and earlier:
>>> "%x" % 0x11012
'11012'
h = 0x11012
result = hex(h)[2:]
This will remove the leading 0x
.
result = hex(h)
这真的很简单。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.