[Tutor] convert binary to ascii

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Sep 2 19:48:28 CEST 2005

On Fri, 2 Sep 2005, Servando Garcia wrote:

> Here is my question : sam in binary is  01110011  01100001  01101101.
>    if given 01110011  01100001  01101101  how would I go back to ascii.

Hi Servando:

If we have strings of ones and zeros, we can turn those into numbers by
using the int() function.  For example:

>>> int("101", 2)
>>> int("110", 2)
>>> int("111", 2)

For more information on int(), see:


There is also a function to convert ordinals back into their ascii
character values.  Take a look at:


and search for the word "ASCII": you should see a function there that will

More information about the Tutor mailing list