项目场景
[1, 2, 3] <= 1
问题描述
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: '<=' not supported between instances of 'list' and 'int'
原因分析
list不支持这种比较大小的操作
解决方案
import numpy as np
a = np.array([1, 2, 3])
b = a <= 1
结果如下:
