0
m1 = [[['64,56'], ['77,9'], ['3,55,44,22,11']]]
m2 = [[[64, 56], [77, 9], [3, 55, 44, 22, 11]]]

How do I go from "m1" to "m2"?

Mo Money
  • 9
  • 5
  • 1
    Does this answer your question? [Convert all strings in a list to int](https://stackoverflow.com/questions/7368789/convert-all-strings-in-a-list-to-int) – BLimitless Nov 12 '21 at 05:02
  • you can refer here: https://stackoverflow.com/questions/7368789/convert-all-strings-in-a-list-to-int – gretal Nov 12 '21 at 05:02

2 Answers2

1

You can use (nested) list comprehension with split:

lst = ['7', '4,9', '9,7', '5,44,9,8']

output = [int(num) for item in lst for num in item.split(',')]
print(output) # [7, 4, 9, 9, 7, 5, 44, 9, 8]
j1-lee
  • 13,764
  • 3
  • 14
  • 26
0

Combine elements into one string using join(), then split() and convert to int using map()

list(map(int,','.join(lst).split(',')))
Алексей Р
  • 7,507
  • 2
  • 7
  • 18