Answers for "python string with list to list"

4

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
0

python list of list to list of string

list_of_string = [''.join(element) for element in list_of_list]
Posted by: Guest on June-02-2020

Code answers related to "python string with list to list"

Python Answers by Framework

Browse Popular Code Answers by Language