Get sorted combinations
问题 I have a input like A = [2,0,1,3,2,2,0,1,1,2,0]. Following I remove all the duplicates by A = list(Set(A)) A is now [0,1,2,3] . Now I want all the pair combinations that I can make with this list, however they do not need to be unique... thus [0,3] equals [3,0] and [2,3] equals [3,2] . In this example it should return [[0,1],[0,2],[0,3],[1,2],[1,3],[2,3]] How do I achieve this? I looked in the iteratools lib. But couldn't come up with a solution. 回答1: >>> A = [2,0,1,3,2,2,0,1,1,2,0] >>> A =