1 # 排列 2 from itertools import product 3 l = [1, 2, 3] 4 print(list(product(l, l))) 5 print(list(product(l, repeat=4))) 6 7 # 组合 8 from itertools import combinations 9 print(list(combinations([1,2,3,4,5], 3)))
原文地址:https://www.cnblogs.com/hahasd/p/12305455.html
时间: 2024-10-08 20:49:11