Pythonic way of removing reversed duplicates in list,data = {tuple(sorted(item)) for item in lst}