Created
June 23, 2017 07:39
-
-
Save ls404/59858be371a6adab90d2b6c03c7ba6ef to your computer and use it in GitHub Desktop.
Compare duplicates in a list.
Fast and ineffective way.
From https://stackoverflow.com/questions/1388818/how-can-i-compare-two-lists-in-python-and-return-matches
This file contains hidden or 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
| >>> a = [1, 2, 3, 4, 5] | |
| >>> b = [9, 8, 7, 6, 5] | |
| >>> set(a) & set(b) | |
| {5} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment