from math import isnan # numpy.isnan can also be used instead
# If the list contains only strings, `if e != ""` can be simplied to `if e`
a = [[e for e in l if e != ""] for l in a]
# Use isnan function to check for nan values
b = [[e for e in l if not isnan(e)] for l in b]
你知道吗列表.删除(“”)删除列表中的第一个“”元素。a不包含“”。您应该为a或b中的每个子列表执行此操作
x for x in b
只查看列表级别1。你知道吗试试这个:
这是正确的版本。你知道吗
相关问题 更多 >
编程相关推荐