Jan-22-2017, 11:34 AM
str.encode gives you the bytes representation of the string. From that you can use the hex method to get the hex values:
>>> s = 'The quick brown fox jumps over the lazy dog.'.encode('utf-8') >>> s b'The quick brown fox jumps over the lazy dog.' >>> s.hex() '54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f672e'That's Python 3.x of course. Sting handling was one of the big changes between 2.x and 3.x.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures