-1

I have something like:

   '[356, 1079, 1220, 1060, 3039, 1197, 4085, 4002, 2395]'

but I want:

   [356, 1079, 1220, 1060, 3039, 1197, 4085, 4002, 2395]

how can I do this in python?

1 Answers1

4
a =  ['[356, 1079, 1220, 1060, 3039, 1197, 4085, 4002, 2395]']
a_real_list = json.loads(a[0])

or

a_real_list = ast.literal_eval(a[0])

or

a_real_list_of_str = a[0][1:-1].split(", ")
Joran Beasley
  • 110,522
  • 12
  • 160
  • 179