string to array python code example
Example 1: python string to array
>>> text = 'a b c'
>>> text = text.split(' ')
>>> text
[ 'a', 'b', 'c' ]
Example 2: convert string to list python
word = 'abc'
L = list(word)
L
word = 'a,b,c'
L = word.split(',')
L
Example 3: python convert string to list
fruit = 'apple oranges banans'
newlist = fruit.split()
print(newlist)
Example 4: how to convert a string to a list python
string.split("separator")
Example 5: convert string to list python
word = "Hey Hello world"
print(list(word))