I'm aware variations of this question have been asked already, but none of the ones I've been able to find have addressed my specific aim.
I am trying to take two lists in Python with string elements and remove the overlapping sections of the two. For example:
list1 = ["25","+","7","*","6","/","7"]
list2 = ["7","*","6"]
Should go to
["25","+","/","7"]
I've considered a list comprehension along the lines of
[i for i in list1 if not in list2]
but this would yield
["25","+","/"]
as both instances of "7" would be taken out.
How can I achieve what I'm trying to do here? Thanks.
Edit - this was marked as a possible duplicate. In my example with the list comprehension, I already explained how it is a different problem to the one linked.