0

How can I Convert these binary input into hex values. Using python 3:

11111000 10011011

01101101 10011101

11100001 01111011

11000001 00010111

1 Answer 1

1

In your case you can do something like:

a = "11111000 10011011 01101101 10011101 11100001 01111011 11000001 00010111"
a = a.replace(" ", "")
i = int(a, 2)
print(hex(i))

A one-liner would be:

print(hex(int("11111000 10011011 01101101 10011101 11100001 01111011 11000001 00010111".replace(" ", ""), 2)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.