python 排列组合 itertools

考虑顺序排列组合permutations

1
2
3
4
5
6
7
8
high_imps_list_all = [['3157',
'3175',
'16',
'34',
'3159']]

import itertools
list(itertools.permutations(high_imps_list_all[0],5))

不考虑顺序 combinations

1
2
3
4
5
6
7
8
high_imps_list_all = [['3157',
'3175',
'16',
'34',
'3159']]

import itertools
list(itertools.combinations(high_imps_list_all[0],5))

注意事项

返回的是元组的列表