Answers for "delete a list of elements from the list python"

2

delete element of a list from another list python

l1 = ["a", "b", "c", "d", "e", "f"]
l2 = ["b", "c", "e"]

l1 = [elt for elt in l1 if elt not in l2]
# l1 = ['a', 'd', 'f']
Posted by: Guest on April-02-2021

Code answers related to "delete a list of elements from the list python"

Python Answers by Framework

Browse Popular Code Answers by Language