具体看这篇文章:
https://blog.csdn.net/weixin_40041218/article/details/80868521
关于& 和and,感受一下三种写法的区别:
list = [1,2,3,4]
k = [col for col in list if (col !=3 & col !=2)]
k
输出[4]
list = [1,2,3,4]
k = [col for col in list if (col !=3) & (col !=2)]
k
输出[1, 4]
list = [1,2,3,4]
k = [col for col in list if (col !=3 and col !=2)]
k
输出[1, 4]