flatten a 2d array python

Solutions on MaxInterview for flatten a 2d array python by the best coders in the world

showing results for - "flatten a 2d array python"
Niko
20 Jan 2020
1arr_2d = [[1, 2, 3], [4, 5, 6]]
2arr_1d = [el for arr in arr_2d for el in arr]
3print(arr_1d) # [1, 2, 3, 4, 5, 6]