computing with characters

Lutz Horn lutz.georg.horn at googlemail.com
Wed Apr 30 02:44:26 EDT 2008


Hi,

2008/4/30 Gary Herron <gherron at islandtraining.com>:
> SL wrote:
> > How can I compute with the integer values of characters in python?
> > Like 'a' + 1 equals 'b' etc
>
>  You can get an integer value from a character with the ord() function.

So just for completion, the solution is:

>>> chr(ord('a') + 1)
'b'

Lutz

-- 
Do you want a Google Mail invitation? Just write me an email!



More information about the Python-list mailing list