我想用单行代码做这样的事情,我可以这样做,还是我必须使用过滤器?
not 0 <= n <= 255 for n in [-1, 256, 23] # True 0 <= n <= 255 for n in [0, 255, 256] # False 0 <= n <= 255 for n in [0, 24, 255] # True
python python-3.x
python ×1
python-3.x ×1