有个 list[1,2,3,4],如何形成 [1,2],[1,3],[1,4],[2,3],[2,4],[3,4]
[list[i], list[j]] for i in range(len(list)) for j in range(i+1, len(list))]
谢谢大佬
[[x, y] for idx, x in enumerate(list) for y in list[idx+1:]]
import itertools
print([list(i) for i in itertools.combinations([1,2,3,4],2)])