>>> 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]
python-使用numpy扁平化列表数据
原文:https://www.cnblogs.com/boye169/p/14956759.html