Return to Snippet

Revision: 43555
at March 26, 2011 03:19 by magicrebirth


Initial Code
>>> lst1 = [1,2,3,4,5,6,7,8,9,0,11,12,13]
>>> lst2 = [5,6,7,12,45,67,89,99]
>>> [i for i in lst1+lst2 if i not in lst1 or i not in lst2]
[1, 2, 3, 4, 8, 9, 0, 11, 13, 45, 67, 89, 99]
>>> 

Initial URL
http://bytes.com/topic/python/answers/649371-getting-difference-between-two-lists

Initial Description


Initial Title
Getting the difference between two lists - Python

Initial Tags
list

Initial Language
Python