Re: computing with characters
- From: "SL" <ni@xxxxxxx>
- Date: Wed, 30 Apr 2008 09:19:22 +0200
"Lutz Horn" <lutz.georg.horn@xxxxxxxxxxxxxx> schreef in bericht
news:mailman.360.1209537877.12834.python-list@xxxxxxxxxxxxx
Hi,
2008/4/30 Gary Herron <gherron@xxxxxxxxxxxxxxxxxx>:
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.
.
Relevant Pages
- Re: PEP 3131: Supporting Non-ASCII Identifiers
... identifiers in Python. ... Because when I am reading source code, even if a particular variable *name* is a sequence of characters that I cannot identify as a word that I know, I can at least spell it out using Latin characters, or perhaps even attempt to pronounce it. ... people who use Python learn the 52 upper/lowercase variants of the latin alphabet. ... (comp.lang.python) - Re: break unichr instead of fix ord?
... I think the best feature of python is not, ... property that a Unicode literal always produces one ... differently" by producing two python characters. ... "surrogate pairs". ... (comp.lang.python) - Re: UTF-8 / German, Scandinavian letters - is it really this difficult?? Linux & Windows XP
... For string literals, with the "coding" declaration, Python will accept ... "coding" declaration to produce a Unicode object which unambiguously ... represents the sequence of characters - ie. something that can be ... > strings and/or gibberished characters in Tk GUI title? ... (comp.lang.python) - Re: String prefix question
... along with how Python deals with this: ... characters to show for the upper 128. ... To solve this problem, Unicode was created. ... front of the string declaration ... (comp.lang.python) - Re: How do I get unicode support in python?
... unable to print any characters outside of ascii. ... What do I need to do to get python on the web server to have unicode ... For Python to be able to "print" unicode characters to the console, ... know the encoding of the console. ... (freebsd-questions) |
|