📅  最后修改于: 2022-03-11 14:45:15.691000             🧑  作者: Mango
def combinations(iterable, r):
pool = tuple(iterable)
n = len(pool)
for indices in permutations(range(n), r):
if sorted(indices) == list(indices):
yield tuple(pool[i] for i in indices)