# -*- coding: utf-8 -*-
"""
Created on Sat Jun 30 11:49:56 2018
@author: zhen
"""
#===============测试排列组合==================
import itertools
# 定义测试数据
list_test = [1,2,3,4,5]
# 定义结果数据
list_result_combinations = []
# ============组合===============
for i in range(1,len(list_test)+1):
# 调用组合函数
iterator = itertools.combinations(list_test,i)
list_result_combinations.append(list(iterator))
print(list_result_combinations)
print('--------------------------------------')
# ============排列===============
list_result_permutations = []
for i in range(1,len(list_test)+1):
# 调用排列函数
iterator = itertools.permutations(list_test,i)
list_result_permutations.append(list(iterator))
print(list_result_permutations)
结果: