Nov-22-2017, 04:41 AM
you can iterate through the string, and run each character through ord():
example:
example:
k = 'kryptonite' ' '.join(format(ord(letter), 'b') for letter in k)result:
Output:'1101011 1110010 1111001 1110000 1110100 1101111 1101110 1101001 1110100 1100101'
or for hex:k = 'kryptonite' ' '.join(format(ord(letter), 'x') for letter in k)
Output:'6b 72 79 70 74 6f 6e 69 74 65'