weird strings question

John Machin sjmachin at lexicon.net
Fri Feb 25 20:51:31 EST 2005


Lucas Raab wrote:
> Is it possible to assign a string a numerical value?? For example, in

> the string "test" can I assign a number to each letter as in "t" =
45,
> "e" =  89, "s" = 54, and so on and so forth??
>
> TIA

>>> for c in 'abcd':
...    print c, ord(c)
...
a 97
b 98
c 99
d 100

If that isn't what you mean, you may need to rephrase your question.




More information about the Python-list mailing list