0
votes

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

11111000 10011011

01101101 10011101

11100001 01111011

11000001 00010111
1

1 Answers

1
votes

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)))