How to change a string to hex [closed]

Python2 has this easy way

>>> "Hello".encode("hex")
'48656c6c6f'

Python3 is not so bad

>>> import binascii
>>> binascii.hexlify(b'Hello')
b'48656c6c6f'

Leave a Comment