import numpy as np
x = np.array([[1,2,5],[2,3,5],[3,4,5],[2,3,6]])
# 输出数组的行和列数
print x.shape # (4, 3)
# 只输出行数
print x.shape[0] # 4
# 只输出列数
print x.shape[1] # 3
或者
In [48]: arr = [[1,4,7,10,15], [2,5,8,12,19], [3,6,9,16,22], [10,13,14,17,24]]
In [49]: len(arr) #行数
Out[49]: 4
In [50]: len(arr[0]) #列数
Out[50]: 5