word to list python code example

Example 1: turn a string into a list of characters python

#Use the function list()
word = list(word)

Example 2: python string to list of chars

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 3: python how to turn a word into a list

wordString = "foobar"
list(wordString)
>>> ['f', 'o', 'o', 'b', 'a', 'r']