Question: Python3 HELP! I read a file in which there are sentences mixed with words and binaries. For example: Frank said 0100000000000010 is his lucky number.

Python3 HELP! I read a file in which there are sentences mixed with words and binaries. For example: "Frank said 0100000000000010 is his lucky number. On the contrary, Jenna thinks 0100000000000011 is the end of our universe."

From the file above I was able to extract out the binaries : "0100000000000010" and "0100000000000011" but I need this number in hex. Python thinks of these numbers as decimal and giving me "5AF3107A400A" and "5AF3107A400B" as hex result. How can I make Python understand that those numbers are already in binary.

Hexadecimal for those number should be : "4002" and "4003"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!