[[0, 0, 3, 50], [50, 100, 4, 20]]
I want to convert the above list to ,
[0, 0, 3, 50, 50, 100, 4, 20].
I tried using the split() but it doesn't work.
[[0, 0, 3, 50], [50, 100, 4, 20]]
I want to convert the above list to ,
[0, 0, 3, 50, 50, 100, 4, 20].
I tried using the split() but it doesn't work.
Try the following:
list_2d = [[0, 0, 3, 50], [50, 100, 4, 20]]
list_1d = [i for nested in list_2d for i in nested]
print(list_1d)