Python 数组维度

Python array dimensions

我目前正在学习 numpy,我找到了 'Array Dimensions'。谁能向我解释什么是数组维度?如何找出数组的维度? 谢谢,

您可以像这样打印数组维度的元组:

print array.shape

假设它是 (2,3)。您的数组可能是:[[1,2,3],[3,2,1]] 所以基本上第一个维度是外部元素的数量,第二个维度是内部元素的数量,依此类推...