How do I convert characters into integers?

Kent Johnson kent3737 at yahoo.com
Wed Dec 15 00:58:04 CET 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