당신은 itertools.product
사용할 수 있습니다
from itertools import product
lst = [['one', 'two', 'three'], ['a', 'b'], ['left', 'right']]
print(list(product(*lst)))
당신이 원하는 것을 있는지 확인
["|".join([p, q, r]) for p, q, r in product(*lst)]
출력 :
[('one', 'a', 'left'), ('one', 'a', 'right'), ('one', 'b', 'left'), ('one', 'b', 'right'), ('two', 'a', 'left'), ('two', 'a', 'right'), ('two', 'b', 'left'), ('two', 'b', 'right'), ('three', 'a', 'left'), ('three', 'a', 'right'), ('three', 'b', 'left'), ('three', 'b', 'right')]
당신이 설명 원하는 문자열을 생산하기
['one|a|left',
'one|a|right',
'one|b|left',
'one|b|right',
'two|a|left',
'two|a|right',
'two|b|left',
'two|b|right',
'three|a|left',
'three|a|right',
'three|b|left',
'three|b|right']
https://docs.python.org/2/library/itertools.html#itertools.combinations를 확인하셨습니까? – fredtantini
예 itertools를 시도하지만 필요한 방식으로 작동하지 않습니다 – Michal
분명히 잘못된 기능을 가지고 있습니다 ... – fredtantini