做个记录
参考链接
pythonisnan_python - 如何检查NaN值?
个人理解
这里对x进行nan判断后,只要不是nan,则都进行输出
from itertools import filterfalse
a = [1,2,3,4,"",None,0]
def isnan(x):
return x!=x
print(list(filterfalse(isnan, a))) # 返回符合要求的元素
输出:
[1, 2, 3, 4, '', None, 0]