Answers for "how to convert a string in to a list"

2

convert all items in list to string python

mylist = [str(i) for i in mylist]
Posted by: Guest on January-18-2021
3

python string list to list

>>> import ast
>>> x = '[ "A","B","C" , " D"]'
>>> x = ast.literal_eval(x)
>>> x
['A', 'B', 'C', ' D']
>>> x = [n.strip() for n in x]
>>> x
['A', 'B', 'C', 'D']
Posted by: Guest on May-06-2021

Code answers related to "how to convert a string in to a list"

Python Answers by Framework

Browse Popular Code Answers by Language