-2

I know the question sounds a bit vague, but this should clear it up.

a = "[200, 30.5, 37]" #This is a string literal, where a[0] = '['
b = [200, 30.5, 37] #This is a list literal, where b[0] = 200

How do I get b from a?

1 Answers1

-4
b  = eval(a)

This should do the trick.

Ashish kulkarni
  • 644
  • 2
  • 7
  • 13
  • 1
    [Why is using 'eval' a bad practice?](https://stackoverflow.com/questions/1832940/why-is-using-eval-a-bad-practice) – pault Jun 18 '19 at 17:04