Re: weird strings question

2005-02-26 Thread Lucas Raab
Robert Kern wrote: 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?? Use a dictionary with the strings as keys. string2num = {} string2num['t

Re: weird strings question

2005-02-25 Thread Robert Kern
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?? Use a dictionary with the strings as keys. string2num = {} string2num['t'] = 45 string2num['

Re: weird strings question

2005-02-25 Thread John Machin
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

weird strings question

2005-02-25 Thread Lucas Raab
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 -- http://mail.python.org/mailman/listinfo/python-list