Is there a simpler way to do the following, which I find myself doing all the time?
>>> hex(ord('H'))
'0x48'
>>> hex(ord('e'))
'0x65'
>>> hex(ord('l'))
'0x6c'
>>> hex(ord('p'))
'0x70'
I suppose something like:
>>> ords = lambda s: [hex(ord(c)) for c in s]
>>> ords('Help')
['0x48', '0x65', '0x6c', '0x70']
But is there something built-in that I can use for this? Or do I need to use the struct
module for anything more than a one-byte print/conversion?