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)))
Python中列表元素排列组合
猜你喜欢
转载自www.cnblogs.com/hahasd/p/12305455.html
今日推荐
周排行