python numpy访问行列元素的方法
import numpy as np a = np.array([[2,1],[10,5]]) print(a) print(a[:,1])#col 1 print(a[1])#row 1 print(a[1,1]) #a[1][1] print(a[0:1,0:1]) row 0:1 col 0:1 # u, d, v = np.linalg.svd(a)
[[ 2 1]
[10 5]]
[1 5]
[10 5]
5
[[2]]
[Finished in 0.3s]