>>> import numpy as np >>> np.array([[1,2,3],[4,5,6]]).flatten() array([1, 2, 3, 4, 5, 6]) >>> np.array([[1,2,3],[4,5,6]]).flatten().tolist() [1, 2, 3, 4, 5, 6]