-2

Would there be a way to convert '[0,0,0,0,0]' back into a list?

I've tried to convert it into an integer, which didn't work. I've searched online but the articles only talk about converting strings that are like 'A BIG HOUSE' into ['A','BIG','HOUSE'].

chrisprof
  • 7
  • 2

1 Answers1

-1

Yes, you can use ast.literal_eval

import ast
my_string = '[0,0,0,0,0]' 
my_list = ast.literal_eval(my_string)
Ron Serruya
  • 3,988
  • 1
  • 16
  • 26