I have two lists, l1
and l2
. I need items from l1
which are not in l2
.
l1 = [2, 3, 4, 5]
l2 = [0, 1, 2, 3]
I want to get only [4,5] - only new values in l1.
[i for i in l1 if not i in l2 ]
Can I do that without iteration?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…