--On January 20, 2006 7:24:47 PM -0800 Sheila King <[EMAIL PROTECTED]> 
wrote:

> --On January 20, 2006 9:18:26 PM -0600 Silas Hundt <[EMAIL PROTECTED]>
> wrote:
...
>> Receive input, cut that string up into individual characters (ALL
>> characters, including spaces), put them in order into a list, then
>> pull them out in order to convert them to a number.
...
>>>> s = "This is a string."
>>>> list(s)
> ['T', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ', 's', 't', 'r', 'i',
> 'n',  'g', '.']

I'm not sure what numbers exactly you want to convert the characters to, 
but the one that springs to my mind are the ordinals for each character. 
So, if that's what you want, you could further do this:

>>> chars = list(s)
>>> chars
['T', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 
'g', '.']
>>> ords = map(ord, chars)
>>> ords
[84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 115, 116, 114, 105, 110, 103, 
46]
>>>

-- 
Sheila King
[EMAIL PROTECTED]
http://www.thinkspot.net/sheila/

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to