Answers for "how to convert a string to a 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
8

string to list python

s = 'hello'
l = list(s)
print(l) # prints ['h', 'e', 'l', 'l', 'o']
Posted by: Guest on July-20-2020
3

how to convert a string to a list python

#How to split a string into a list (Python)

#"separator" should be replaced with the string you want to split with
string.split("separator")
Posted by: Guest on December-08-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 "how to convert a string to a list python"

Python Answers by Framework

Browse Popular Code Answers by Language