python word to list code example
Example 1: python word to list
l = list('abcd') # ['a', 'b', 'c', 'd']
l = map(None, 'abcd') # ['a', 'b', 'c', 'd']
l = [i for i in 'abcd'] # ['a', 'b', 'c', 'd']
import re # importing regular expression module
l = re.findall('.', 'abcd')
print(l) # ['a', 'b', 'c', 'd']
Example 2: python how to turn a word into a list
wordString = "foobar"
list(wordString)
>>> ['f', 'o', 'o', 'b', 'a', 'r']