如何检查数组中的所有元素在Python Numpy中是否为0或2?例如
if (all elements in c == 0) or (all elements in c == 2):
This is true
else :
This is False
Run Code Online (Sandbox Code Playgroud)
表示如果c = numpy.array[0,0,2]是true,
但是如果c=numpy.array[0,1,2]是这样false。
有人可以给我一段代码吗?