Skip to content

Instantly share code, notes, and snippets.

@fourcolors
Created January 26, 2021 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fourcolors/1baecfc08b800aa5281dfd787ef87e02 to your computer and use it in GitHub Desktop.
Save fourcolors/1baecfc08b800aa5281dfd787ef87e02 to your computer and use it in GitHub Desktop.
Find the difference of two lists in python
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