itertools ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฐ๋ณต ์ฒ๋ฆฌํ๊ธฐ ์ํ ํจ์ ์ ๊ณต import itertools list = [1,2,3,4,5] ์กฐํฉ list์์์ ์์ ์ถ์ถํ์ฌ ์ถ๋ ฅํ๋ค for x in itertools.combinations(list,2): print(x) (1,2) (1,3) (1,4) (1,5) (2,3) (2,4) (2,5) (3,4) (3,5) (4,5) ํ๋์ ์ฐ์๋ ๋ฐฐ์ด๋ก ๊ฒฐํฉ list์ a,b,c๋ฅผ ๊ฒฐํฉํ๊ณ ์์ ๊ฐ ํ๋ฆฐํธ for x in itertools.chain(list,['a','b'.'c']): print(x) 1 2 3 4 5 a b c