how to convert string to list of characters in python code example

Example 1: convert string to list python

# To split the string at every character use the list() function
word = 'abc'
L = list(word)
L
# Output:
# ['a', 'b', 'c']

# To split the string at a specific character use the split() function
word = 'a,b,c'
L = word.split(',')
L
# Output:
# ['a', 'b', 'c']

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

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

Example 3: python convert string to list

fruit = 'apple oranges banans'
newlist = fruit.split()
print(newlist)

Example 4: python string to list of letters

# Python3 program to Split string into characters
def split(word):
    return list(word)
     
# Driver code
word = 'geeks'
print(split(word))

#Output
['g', 'e', 'e', 'k', 's']