具有唯一值的排列
>>> list(itertools.permutations([1, 1, 1]))[(1, 1, 1), (1, 1, 1), (1, 1, 1), (1, 1, 1), (1, 1, 1), (1, 1, 1)]
编辑:
x = itertools.product((0, 1, 'x'), repeat=X)x = sorted(x, key=functools.partial(count_elements, elem='x'))
sorted
陪伴而非守候
胡子哥哥
相关分类