Message100422
It is a common practice to separate hex digits with a "thousands" separator every 4 hex digits.
0x1234_abcd
Although python does not accept the _ as a thousands separator in hex notation, neither is the thousands separator in base 10
Snippet that prints hex thousands with a _ separator
number = 0xef5678abcd1234
def hex_thousands(number):
txt="{0:X}".format(number)
txt_out = ""
i = range(-4,-1 * (len(txt) + 4), -4)
ii = i[:]
ii.insert(0, None)
for (j, k) in zip(i, ii):
if txt_out:
txt_out = "_" + txt_out
txt_out = txt[j:k] + txt_out
return txt_out
print hex_thousands(number) |
|
Date |
User |
Action |
Args |
2010-03-04 21:46:46 | hardkrash | set | recipients:
+ hardkrash |
2010-03-04 21:46:46 | hardkrash | set | messageid: <1267739206.12.0.0725020069518.issue8062@psf.upfronthosting.co.za> |
2010-03-04 21:46:44 | hardkrash | link | issue8062 messages |
2010-03-04 21:46:44 | hardkrash | create | |
|