[Tutor] string to list of characters

alan.gauld@bt.com alan.gauld@bt.com
Wed, 8 Aug 2001 11:23:38 +0100


> I want to turn a word into a list of the letters, eg "dog" 
> Is there a simple way to use split() or something to do this, 

Probably, but,

> to loop through each letter of the string?

>>> s = 'dog'
>>> c = []
>>> for ch in s: c.append(ch)
>>> c
['d', 'o', 'g']
>>>

Doesn't seem too onerous to me...

Alan G