Answers for "convert string list to array python"

44

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
0

string list to list

import ast

l1 = ['aa','bb','cc']
s = str(l1)
ast.literal_eval(s)
>>> ['aa','bb','cc']
Posted by: Guest on January-11-2022

Code answers related to "convert string list to array python"

Python Answers by Framework

Browse Popular Code Answers by Language