python convert list string to list 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: 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")

Tags:

Java Example