code
import numpy as np a=np.array([[2, 2, 3], [3, 5, 12]]) b=np.unique(a) c = b>10 d = np.extract(c, b) if np.any(d): print(d)
np.any(data)
若为空,返回 False
若不为空,返回 True
参考
1.
完
【python基础】判断矩阵为空
原文:https://www.cnblogs.com/happyamyhope/p/15211300.html