[Tutor] convert binary to ascii

Travis Spencer travislspencer at gmail.com
Fri Sep 2 20:14:11 CEST 2005


On 9/2/05, Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:

Hey Danny,

> If we have strings of ones and zeros, we can turn those into numbers by
> using the int() function.  For example:
> 
> ######
> >>> int("101", 2)
> 5
> >>> int("110", 2)
> 6
> >>> int("111", 2)
> 7

Oh, that's nice.  I guess my solution was the total C hacker's way;
not very pythonic :-)  Thanks for the info.

-- 

Regards,

Travis Spencer


More information about the Tutor mailing list