Is there a function in python to split a word into a list of single letters? e.g
s="Word to Split"
to get
wordlist=['W','o','r','d','','t','o' ....]
Is there a function in python to split a word into a list of single letters? e.g
s="Word to Split"
to get
wordlist=['W','o','r','d','','t','o' ....]
>>> list("Word to Split")
['W', 'o', 'r', 'd', ' ', 't', 'o', ' ', 'S', 'p', 'l', 'i', 't']
Why do you need it? Most of the time you can use a string like a list.
Try:
s = "Word to Split"
wordlist = list(s)
wordlist
That should give you what you need (['W','o','r','d',' ','t','o',' ','S','p','l','i','t']).
Abuse of the rules, same result: (x for x in 'Word to split')
Actually an iterator, not a list. But it's likely you won't really care.