computing with characters

SL ni at hao.com
Wed Apr 30 03:19:22 EDT 2008


"Lutz Horn" <lutz.georg.horn at googlemail.com> schreef in bericht 
news:mailman.360.1209537877.12834.python-list at python.org...
> 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'

thanks :) I'm a beginner and I was expecting this to be a member of string 
so I couldnt find it anywhere in the docs. 




More information about the Python-list mailing list