How do I convert characters into integers?

Kent Johnson kent3737 at yahoo.com
Tue Dec 14 18:58:04 EST 2004


Markus Zeindl wrote:
> 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]

for ch in message:
     ...

is simpler and more idiomatic.

Kent



More information about the Python-list mailing list