[Tutor] string to binary and back... Python 3
Steven D'Aprano
steve at pearwood.info
Thu Jul 19 00:37:52 CEST 2012
On Wed, Jul 18, 2012 at 10:22:43PM +0000, Prasad, Ramit wrote:
> I forgot to say, that once you have the integer equivalents,
> you can then convert that easily to binary using bin.
> I used ast.literal_eval to convert from binary string
> (as returned from bin) to number, but there might be better
> ways.
Do you mean something like this?
py> int('111001010100100', 2)
29348
--
Steven
More information about the Tutor
mailing list