import numpy as np
k = np.matrix([[1, 2, 3, 4,6],
[5, 6, 7, 8,9],
[9, 10, 11, 12,13]])
print(np.shape(k)) # 输出(3,5)表示矩阵为3行5列
print(k.shape[0]) # shape[0]输出3,为矩阵的行数
print(k.shape[1]) # 同理shape[1]输出列数5
python中的shape[0]和shape[1]
最新推荐文章于 2023-09-16 16:09:21 发布