What is the easiest way in Python to represent a number from 0
to 65535
using two bytes?
For example 300
in decimal is 0000000100101100
in binary and 012C
in hexadecimal.
What I want to get as output when I get 300
is two bytes:
- first is
00101100
(in binary representation) - second is
00000001
(in binary representation)
What is the easiest way to do it?