0

I need to turn

x = ["['born', '0', '15']", "['in', '2', '15']", "['a', '2', '15']", "['world', '3', '00']"]

into

x = [['born', '0', '15'], ['in', '2', '15'], ['a', '2', '15'], ['world', '3', '00']]

as it coded so that the first value of the nested list would be used as a name, the second value would be length in hours and third value is length in minutes.

Barmar
  • 741,623
  • 53
  • 500
  • 612
brian
  • 1

1 Answers1

0

This is about how to convert string to list You can try something as below

y = []
for i in x:
    y.append(eval(i))
print(y)

output

[['born', '0', '15'], ['in', '2', '15'], ['a', '2', '15'], ['world', '3', '00']]
ALPHATU
  • 34
  • 4