在 Python 中,可以使用 ndarray
对象的 shape
属性获取数组的维度,代码如下:
import numpy as np
arr = np.array([[1, 2, 3], [4, 5, 6]])
print(arr.shape)
在 Python 中,可以使用 ndarray
对象的 shape
属性获取数组的维度,代码如下:
import numpy as np
arr = np.array([[1, 2, 3], [4, 5, 6]])
print(arr.shape)