Created
February 7, 2013 21:25
-
-
Save lambdamusic/4734332 to your computer and use it in GitHub Desktop.
Python: Getting the difference between two lists - Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 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] | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment