I am using chr
and int
to convert a binary representation string to real binary value.
What I did is
n=int('0101011',2)
binary=chr(n)
Then binary
is the real binary value of the representation string.
But what if the string I gave to int is larger than 256 in decimal?
Any solution?
PS:
The reason I use chr is I want to convert n
to a string so that I can write it to a file, using f.write()
.
And this question is originated from this question