flatten a 2d array python

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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
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]