Quick question, some data was corrupted and now all the lists I had have turned into strings:
e.g:
["en", "ru"]
,
is now :
str(["en", "ru"])
What is the best way to turn it back to list?
Quick question, some data was corrupted and now all the lists I had have turned into strings:
e.g:
["en", "ru"]
,
is now :
str(["en", "ru"])
What is the best way to turn it back to list?
Use ast.literal_eval
. Do not use eval
it is unsafe.
>>> import ast
>>> ast.literal_eval(str(["en", "ru"]))
['en', 'ru']