Answers for "convert list of list to list of string python"

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
6

python list to string

mystring = 'hello, world'

mylist = string1.split(', ') #output => ['hello', 'world']

myjoin1 = ', '.join(mylist) #output => 'hello, world'
myjoin2 = ' '.join(mylist) #output => 'hello world'
myjoin3 = ','.join(mylist) #output => 'hello,world'
Posted by: Guest on May-08-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 list of list to list of string python"

Python Answers by Framework

Browse Popular Code Answers by Language