I need to format a dictionary with multiple integer lists as hex in python 2.7.
I've found a way to format integers from a dictionary as hex. In this example the hex will work, the hexlist will not.
dict = {
"hex": 0x12,
"hexlist": [0x13, 0x14]
}
print("{hex:x}, {hexlist:x}".format(**dict))
(Python Sting Formatting - Real Python)
And there is also a way to print a integer list as hex using:
''.join('{:02X}'.format(hex) for hex in hexlist)
(Format ints into string of hex)
But I can't figure out how to combine the two...