import numpy as np
matrix= np.arange(1,9).reshape((3,3))# Original matrixprint(matrix)# Number of rows and columns of the said matrixprint(matrix.shape)
Python
输出:
[[123][456][789]](3,3)
Python
示例 :
import numpy as np
matrix= np.arange(10,15).reshape((3,2))# Original matrix:print(matrix)# Number of rows and columns of the said matrixprint(matrix.shape)