小编Bla*_*ake的帖子

Python从列表中删除空项

我在python中创建了以下列表DynamoBIM:

a = [["f", "o", "c"], [null, "o", null], [null, "o", null]]
Run Code Online (Sandbox Code Playgroud)

我想从此列表中删除空项以创建此列表:

a = [["f", "o", "c"], ["o"], ["o"]]
Run Code Online (Sandbox Code Playgroud)

我尝试过list.remove(x),filters,for-loops和其他一些方法,但似乎无法摆脱这些错误.

我怎样才能做到这一点?

python null list filter

1
推荐指数
2
解决办法
5312
查看次数

标签 统计

filter ×1

list ×1

null ×1

python ×1