排列
例如:
输入为
[‘1’,’2’,’3’]和3
输出为
[‘111’,’112’,’113’,’121’,’122’,’123’,’131’,’132’,’133’,’211’,’212...from itertools import product
l = [1, 2, 3]
print list(product(l, l))
print list(product(l, repeat=3))
组合...例如:
输入为
[1, 2, 3]和2
输出为
[1, 2], [1, 3], [2, 3] 不考虑顺序
from itertools import combinations
l =