Answer the question
In order to leave comments, you need to log in
Why ord("B") = 66 and not 42 in python?
Guys, you need to convert text to hexadecimal code via ord() in python.
Why ord("B") = 66 and not 42?
For example,
"Bill Gates" --> "42 69 6c 6c 20 47 61 74 65 73" ( it should be ).
And I get "66 105 108 108 32 71 97 116 101 115" .
Where is the mistake?
Answer the question
In order to leave comments, you need to log in
>>> s = "66 105 108 108 32 71 97 116 101 115"
>>> x = [format(int(i), 'x') for i in s.split()]
>>> ' '.join(x)
'42 69 6c 6c 20 47 61 74 65 73'
>>>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question