To use only the built-in modules, you can get the integer value with ord and then convert it to a hexadecimal number:
list_of_hex = [str(hex(ord(z)))[2:] for z in out] print " ".join(list_of_hex)
If you just need a hexadecimal list, then str() and [2:] not needed
The output of this and hexify() versions is of type str and should work fine for a web application.
source share