list as string to list python code example

Example 1: list to string python

List = ["ITEM1", "ITEM2", "ITEM3"]
string_version = "".join(List)

print(string_version)

Example 2: 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 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")

Example 4: python3 create list from string

input = ['word1, 23, 12','word2, 10, 19','word3, 11, 15']
output = []
for item in input:
    items = item.split(',')
    output.append([items[0], int(items[1]), int(items[2])])