代码:
import numpy as np a = np.array([[1,3,5],[5,8,3],[3,1,2]]) b = np.where(a == 1) b1 = np.argwhere(a == 1) print(b) print(b1)
输出:
emulated/0/qpython/4.py" && exit < (array([0, 2], dtype=int32), array([0, 1], dtype=int32)) [[0 0] [2 1]] #[QPython] Press enter to exit ...



