Created
January 26, 2021 06:25
-
-
Save fourcolors/1baecfc08b800aa5281dfd787ef87e02 to your computer and use it in GitHub Desktop.
Find the difference of two lists in 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
list1 = [1,2,3,4] | |
list2 = [1,2,3,4,5,6] | |
non_matching_items = list(set(list2).difference(set(list1))) | |
print(non_matching_items) | |
# [5, 6] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment