binary to decimal conversion

Mike Fletcher mfletch at tpresence.com
Mon Mar 20 00:59:38 CET 2000


Out of curiosity, why is this (or any of the other exotic solutions put
forth) better than:

import string
string.atoi( value, 2)

(or, in your case)

import string
string.atoi( value[:-1], 2 )

???
Mike

-----Original Message-----
From: wheineman [mailto:1wheinemanNOwhSPAM at uconect.net.invalid]
Sent: Sunday, March 19, 2000 5:41 PM
To: python-list at python.org
Subject: Re: binary to decimal conversion


Okay, here my decimal to string representing binary value. I
append a lowercase b to the end to make it more readable (for me)
and you can get the number of bits by taking the len() - 1.
...




More information about the Python-list mailing list