You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I have an integer that I want to encode as a hex string, but I don't
want "0x" at the beginning, nor do I want "L" at the end if it happened
to be a long. The result needs to be something I can pass to int(h, 16)
to get back my original integer.
The brute force way works:
h = hex(i)
assert h.startswith('0x')
h = h[2:]
if h.endswith('L'):
h = h[:-1]
but I'm wondering if there's some built-in call which gives me what I
want directly. Python 2.7.
Tim Chase
unread,
Dec 24, 2012, 10:58:01 AM12/24/12
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Roy Smith, pytho...@python.org
Would something like
h = "%08x" % i
or
h = "%x" % i
work for you?
-tkc
Roy Smith
unread,
Dec 24, 2012, 11:21:15 AM12/24/12
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message