How do I convert characters into integers?
Markus Zeindl
MarkusZeindl at web.de
Tue Dec 14 16:30:12 EST 2004
Hello,
I want to write a simple encrypter, but I've got a problem:
How can I convert characters into integers?
I have got a string from the user, for example "Hi!".
Now I get every character with a loop:
<code>
buffer = ""
for i in range(len(message)):
ch = message[i-1:i]
...
</code>
The character is saved in ch.
Here is the problem. I got a string with one character and I
want his ascii representain, for "a" -> 97
but I want to calculate like iCh = iCh+3 or something else.
The next step is how I convert it back to an char and append it
to the buffer, but that' no problem.
thx
More information about the Python-list
mailing list