How to covert ASCII to integer in Python?

David C. Ullrich dullrich at sprynet.com
Fri May 30 10:34:38 EDT 2008


In article <mailman.1763.1212139351.12834.python-list at python.org>,
 "Skonieczny, Chris" <Skonieczny.C at emssatcom.com> wrote:

> YOU SHOULD REMOVE or CORRECT YOUR POST here: 
> http://mail.python.org/pipermail/python-list/2007-February/427841.html  

Why? There's nothing wrong there.

> It is not true - eg. try : 
> a='P'            # P is ASCII , isn't it ? 
> b=int(a)
> and what you will get ? An error !!!

You really don't see any difference between
"convert '1' to an integer" and "convert 'P' to an integer"?

In case there's actually a problem you're trying to solve
here, try ord instead of int.

> Or probably you yourself should - quote : 
> "You probably should go through the tutorial ASAP that is located here:
> 
> http://docs.python.org/tut/ "
> 
> ---------------------------------------------------------------------
> [Image]

-- 
David C. Ullrich



More information about the Python-list mailing list