import numpy as np
y=np.array([[1,0,1,1],[1,0,1,2],[1,0,1,1],[1,0,1,1]])#定义矩阵
print(np.argwhere(y==1))#输出一维列表y=1时的坐标!
[在这里插入图片描述](https://img-blog.csdnimg.cn/20190516183107984.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzIyNDcyMDg5,size_16,color_FFFFFF,t_70)