Python以元素方式列出列表列表

use*_*758 5 python numpy list

以元素为单位列出数字列表的最佳方法是什么?

例如

[[1,2,3],[2,3,4],[3,4,5]]

-> [6,24,60]
Run Code Online (Sandbox Code Playgroud)

Dan*_*iel 5

用途np.prod:

>>> a = np.array([[1,2,3],[2,3,4],[3,4,5]])
>>> np.prod(a,axis=1)
array([ 6, 24, 60])
Run Code Online (Sandbox Code Playgroud)