Python
리스트안에서 서로 대응 튜플 만들기 ( 중복 없이)
흰곰곰
2019. 10. 9. 21:35
import itertools as it
print(list (range(groups.size)) )
'''[0,1,2,3,4]'''
combs = it.combinations(range(groups.size), 2)
list(combs)
'''[(0,1), (0,2), (0,3), (0,4), (1,2), (1,3), (1,4), (2,3), (2,4), (3,4)'''