python排列组合

python排列组合

import itertools
for i in itertools.combinations('12345', 4):
    print(i,"    ")
    print(i[0])
print('\n')

 

(wind_2021) F:\PytorchProject\yolov5-master>
(wind_2021) F:\PytorchProject\yolov5-master>python test_combination.py
('1', '2', '3', '4')
1
('1', '2', '3', '5')
1
('1', '2', '4', '5')
1
('1', '3', '4', '5')
1
('2', '3', '4', '5')
2



(wind_2021) F:\PytorchProject\yolov5-master>
(wind_2021) F:\PytorchProject\yolov5-master>

 

 

 

##############

posted @ 2022-03-05 19:53  西北逍遥  阅读(57)  评论(0编辑  收藏  举报