numpy的shape获取矩阵的维度

74 阅读1分钟
import numpy as np
a=np.array([[1,2,3,4],[1,2,3,4]])
print(a.shape[0])
#2
print(a.shape[1])
#4