So I have a list of python formatted like:
x = ['[1,2,3]', '[4,5,6,]', ...]
Is there a way to convert the "inner lists" to actual lists? So the output would be
x = [[1,2,3], [4,5,6], ....]
Thanks!
You can use ast.literal_eval for this kind of conversion. You can use map to apply the conversion to each element of your list.
from ast import literal_eval
x = ['[1,2,3]', '[4,5,6,]']
x = map(literal_eval, x)
print x
gives
[[1, 2, 3], [4, 5, 6]]