1 2 3 4 5 6 7 8 9 10 11 12
| import itertools for i in itertools.product('ABCD', repeat = 2): print (''.join(i),end=' ') >> AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD
import itertools a = (1, 2, 3) b = ('A', 'B', 'C') c = itertools.product(a,b) for i in c: print(i,end=' ') (1, 'A') (1, 'B') (1, 'C') (2, 'A') (2, 'B') (2, 'C') (3, 'A') (3, 'B') (3, 'C')
|