I have a question about Python python essence output!

Asked 2 years ago, Updated 2 years ago, 17 views

I want to receive and save hexadecimal data a and output it in the form a = 0xa3 = 0b10100011 but I don't know how to convert binary.

a = input("hexadecimal a = ")
print("a = "+a+____)

python

2022-09-20 17:28

1 Answers

You can do it as below.

a=int(input("hexadecimal a = "),16)
print("a =",bin(a))


2022-09-20 17:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.