python 排列组合

import itertools

#排列
list1 = list(itertools.permutations([1,2,3,4,5,6],2))
# print(list1)
print(len(list1))
# list2 = itertools.permutations([1,2,3,4,5,6],2)
# print(tuple(list2))

#组合
list3 = list(itertools.combinations([1,2,3,4,5,6],2))
# print(list3)
print(len(list3))

#排列组合
list4 = list(itertools.product([1,2,3,4,5,6,7,8,9,0],repeat=3))
# print(list4)
print(len(list4))

posted on 2019-05-09 09:46  泡面小网管  阅读(187)  评论(0编辑  收藏  举报

导航