Answers for "convert string to list python"

31

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']
Posted by: Guest on February-18-2020
3

python convert string to list

fruit = 'apple oranges banans'
newlist = fruit.split()
print(newlist)
Posted by: Guest on June-28-2020
-1

convert string to list python

word = "Hey Hello world"
print(list(word))
# output
# ["Hey", "Hello", "world"]
Posted by: Guest on November-30-2020

Code answers related to "convert string to list python"

Python Answers by Framework

Browse Popular Code Answers by Language