Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zhoudaxia233/5f00befdb84c86569ffca972475eadcd to your computer and use it in GitHub Desktop.
Save zhoudaxia233/5f00befdb84c86569ffca972475eadcd to your computer and use it in GitHub Desktop.
Remove reversed duplicates in list
lst = [[0, 1], [0, 4], [1, 0], [4, 0]]
data = {tuple(item) for item in map(sorted, lst)}     # method 1
data = {tuple(sorted(item)) for item in lst}          # method 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment