l = \"[\'Hello\', \'my\', \'name\', \'is\', \'Apple\']\"
l1 = [\'Hello\', \'my\', \'name\', \'is\', \'Apple\']
type(l)
returns str
ast.literal_eval is a nice approach. For those preferint string manipulation, another option is:
l1 = [x[1:-1] for x in l[1:-1].split(', ')]
the ast
module has a literal_eval
that does what you want
import ast
l = "['Hello', 'my', 'name', 'is', 'Apple']"
l1 = ast.literal_eval(l)
Outputs:
['Hello', 'my', 'name', 'is', 'Apple']
docs