版本相關資訊:
System version : Windows 10 64-bit
Python version : Python 3.6.0 :: Anaconda 4.3.1 (64-bit)
Python version : Python 3.6.0 :: Anaconda 4.3.1 (64-bit)
Codes:
list1=[1,2,3,3,2]
list2=[2,3]
list3 = [x for x in list1 if x not in list2]
print(list3)
結果:
[1]
沒有留言:
張貼留言