Python中怎样使用shape计算矩阵的行和列

1 >>> a=mat([[1,2,3],[5,6,9]]);
2 >>> a
3 matrix([[1, 2, 3],
4         [5, 6, 9]])
5 >>> shape(a)[0]
6 2
7 >>> shape(a)[1]
8 3

如上面的a矩阵,2行3列;计算行使用shape(a)[0];计算列使用shape(a)[1];