[[0, 0, 3, 50], [50, 100, 4, 20]]
我想把上面的列表转换成,
[0, 0, 3, 50, 50, 100, 4, 20].
我试过使用split()但不起作用。
尝试以下方法:
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)