I have a the following string in Python:
x = "['good', 'bad', 'something', 'another']"
And I want to convert it into a list y
, such that y[0] would give me good
, and y[1] would give me bad
.
I tried many ways such as creating a for loop and trying x[0] or x[0][0], but all I reached was the first char, not the whole word. I also tried:
y = list(x)
But no help.
Is there a way to do it on Python?