I have two lists like:
list1 = ['square','circle','triangle']
list2 = ['red','green']
How can I create all permutations of these lists, like this:
[
'squarered', 'squaregreen',
'redsquare', 'greensquare',
'circlered', 'circlegreen',
'redcircle', 'greencircle',
'trianglered', 'trianglegreen',
'redtriangle', 'greentriangle'
]
Can I use itertools
for this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…