私信  •  关注

chris p bacon

chris p bacon 最近创建的主题
chris p bacon 最近回复了
6 年前
回复了 chris p bacon 创建的主题 » 如何在python 3中从嵌套列表中删除多个项?

你可以简单地使用map和filter

split_list = [["a", "b", "c"], ["SUB", "d", "e", ], ["f", "Billing"]]
remove_list = ["SUB", "Billing", "INDEPENDENT", "DR"]
split_list = list(map(lambda x: list(filter(lambda i: i not in remove_list, x)), split_list))

print(split_list)