catspeake
这是您的排列的代码:# Print CSV headerprint("Column 1,Column 2,Column 3,Column 4,Column 5,Column 6")A = ['a', 'b', 'c', 'd', 'e']B = ['f', 'g', 'h', 'i', 'j']C = ['k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't']for a1 in range(0, len(A)): for a2 in range(a1 + 1, len(A)): for b1 in range(0, len(B)): for b2 in range(b1 + 1, len(B)): for c1 in range(0, len(C)): for c2 in range(c1 + 1, len(C)): print(A[a1] + "," + A[a2] + "," + B[b1] + "," + B[b2] + "," + C[c1] + "," + C[c2])它将为问题中指定的输入打印 4500 行。它假定顺序无关紧要,因此如果(a, b)出现,(b, a)则不会出现。它也不输出一个字母两次(a, a)就不会出现。如果您想要双字母,请替换a1 + 1为a1(for band cas well)。如果顺序很重要(因此您想要(a, b) 和 (b, a)),请替换a1 + 1为0(forb和cas well)。