I have this string
'['foo', 'faa', 'fee']'
I want to transform it as a list of strings like:
['foo', 'faa', 'fee']
how could I do that?
I have this string
'['foo', 'faa', 'fee']'
I want to transform it as a list of strings like:
['foo', 'faa', 'fee']
how could I do that?
Use ast
package
from ast import literal_eval
s = "['foo', 'faa', 'fee']"
l = literal_eval(s)
print(type(l))
Output
<class 'list'>