Array shape

The array M in the example has five rows and three columns. To get its shape, use the shape value that comes with numpy arrays.

>>> M = np.loadtxt("M.txt")
>>> print(M)
[[  1.  -2.   1.]
 [  2.  -4.   2.]
 [  3.  -6.   3.]
 [  4.  -8.   4.]
 [  5. -10.   5.]]
>>> print(M.shape)
(5, 3)