Let's say I have this table:
hello = ["hello","world"]
Now I convert it to a string: hellostring = str(hello)
And now I want to convert it back to a table. How can I do this?
Let's say I have this table:
hello = ["hello","world"]
Now I convert it to a string: hellostring = str(hello)
And now I want to convert it back to a table. How can I do this?
You can use ast.literal_eval
:
from ast import literal_eval
literal_eval(hellostring)
input: hellostring = "['hello', 'world']"
output: ['hello', 'world']