标签:color for循环 元素 result int yield repeat 一个个 print
今天看见一个烧脑的代码,一时没看懂结果,刨个坑,看懂填
def product(*args, repeat=1): pools = [tuple(pool) for pool in args] * repeat result = [[]] for pool in pools: result = [x+[y] for x in result for y in pool] for prod in result: yield tuple(prod) rtn = product(‘xyz‘, ‘12‘, repeat=3) print(list(rtn)) #result:
[(‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘), (‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘), (‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘), (‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘), (‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘), (‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘), (‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘), (‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘), (‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘), (‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘), (‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘), (‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘), (‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘), (‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘), (‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘), (‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘), (‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘), (‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘), (‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘), (‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘), (‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘), (‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘), (‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘), (‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘), (‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘), (‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘), (‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘), (‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘), (‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘), (‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘), (‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘), (‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘), (‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘), (‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘), (‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘), (‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘), (‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘), (‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘), (‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘), (‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘), (‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘), (‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘), (‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘), (‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘), (‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘), (‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘), (‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘), (‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘), (‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘), (‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘), (‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘), (‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘), (‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘), (‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘), (‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘), (‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘), (‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘), (‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘), (‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘), (‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘), (‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘), (‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘), (‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘), (‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘), (‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘), (‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘), (‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘), (‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘), (‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘), (‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘), (‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘), (‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘), (‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘), (‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘), (‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘), (‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘), (‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘), (‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘), (‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘), (‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘), (‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘), (‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘), (‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘), (‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘), (‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘), (‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘), (‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘), (‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘), (‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘), (‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘), (‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘), (‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘), (‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘), (‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘), (‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘), (‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘), (‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘), (‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘), (‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘), (‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘), (‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘), (‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘), (‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘), (‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘), (‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘), (‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘), (‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘), (‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘), (‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘), (‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘), (‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘), (‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘), (‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘), (‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘), (‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘), (‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘), (‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘), (‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘), (‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘), (‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘), (‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘), (‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘), (‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘), (‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘), (‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘), (‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘), (‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘), (‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘), (‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘), (‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘), (‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘), (‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘), (‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘), (‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘), (‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘), (‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘), (‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘), (‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘), (‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘), (‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘), (‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘), (‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘), (‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘), (‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘), (‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘), (‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘), (‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘), (‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘), (‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘), (‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘), (‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘), (‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘), (‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘), (‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘), (‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘), (‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘), (‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘), (‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘), (‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘), (‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘), (‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘), (‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘), (‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘), (‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘), (‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘), (‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘), (‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘), (‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘), (‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘), (‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘), (‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘), (‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘), (‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘), (‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘), (‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘), (‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘), (‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘), (‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘), (‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘), (‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘), (‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘), (‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘), (‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘), (‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘), (‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘), (‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘), (‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘), (‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘), (‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘), (‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘), (‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘), (‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘), (‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘), (‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘), (‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘), (‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘), (‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘), (‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘), (‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘), (‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘), (‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘), (‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘), (‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘), (‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘), (‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘), (‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘), (‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘), (‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘), (‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘), (‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘), (‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘), (‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘), (‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘), (‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘), (‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘), (‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘)]
##############################################################33
pools=[(‘x‘, ‘y‘, ‘z‘), (‘1‘, ‘2‘), (‘x‘, ‘y‘, ‘z‘), (‘1‘, ‘2‘), (‘x‘, ‘y‘, ‘z‘), (‘1‘, ‘2‘)]
result=
[[‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘], [‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘], [‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘], [‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘], [‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘], [‘x‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘], [‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘], [‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘], [‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘], [‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘], [‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘], [‘x‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘], [‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘], [‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘], [‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘], [‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘], [‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘], [‘x‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘], [‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘], [‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘], [‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘], [‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘], [‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘], [‘x‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘], [‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘], [‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘], [‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘], [‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘], [‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘], [‘x‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘], [‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘], [‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘], [‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘], [‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘], [‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘], [‘x‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘], [‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘], [‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘], [‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘], [‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘], [‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘], [‘x‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘], [‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘], [‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘], [‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘], [‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘], [‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘], [‘x‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘], [‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘], [‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘], [‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘], [‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘], [‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘], [‘x‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘], [‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘], [‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘], [‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘], [‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘], [‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘], [‘x‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘], [‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘], [‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘], [‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘], [‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘], [‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘], [‘x‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘], [‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘], [‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘], [‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘], [‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘], [‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘], [‘x‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘], [‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘], [‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘], [‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘], [‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘], [‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘], [‘y‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘], [‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘], [‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘], [‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘], [‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘], [‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘], [‘y‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘], [‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘], [‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘], [‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘], [‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘], [‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘], [‘y‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘], [‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘], [‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘], [‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘], [‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘], [‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘], [‘y‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘], [‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘], [‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘], [‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘], [‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘], [‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘], [‘y‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘], [‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘], [‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘], [‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘], [‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘], [‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘], [‘y‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘], [‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘], [‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘], [‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘], [‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘], [‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘], [‘y‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘], [‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘], [‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘], [‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘], [‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘], [‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘], [‘y‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘], [‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘], [‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘], [‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘], [‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘], [‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘], [‘y‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘], [‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘], [‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘], [‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘], [‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘], [‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘], [‘y‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘], [‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘], [‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘], [‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘], [‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘], [‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘], [‘y‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘], [‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘], [‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘], [‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘], [‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘], [‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘], [‘y‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘], [‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘], [‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘], [‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘], [‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘], [‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘], [‘z‘, ‘1‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘], [‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘], [‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘], [‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘], [‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘], [‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘], [‘z‘, ‘1‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘], [‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘], [‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘], [‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘], [‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘], [‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘], [‘z‘, ‘1‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘], [‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘], [‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘], [‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘], [‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘], [‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘], [‘z‘, ‘1‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘], [‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘], [‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘], [‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘], [‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘], [‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘], [‘z‘, ‘1‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘], [‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘], [‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘], [‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘], [‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘], [‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘], [‘z‘, ‘1‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘], [‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘1‘], [‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘x‘, ‘2‘], [‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘1‘], [‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘y‘, ‘2‘], [‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘1‘], [‘z‘, ‘2‘, ‘x‘, ‘1‘, ‘z‘, ‘2‘], [‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘1‘], [‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘x‘, ‘2‘], [‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘1‘], [‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘y‘, ‘2‘], [‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘1‘], [‘z‘, ‘2‘, ‘x‘, ‘2‘, ‘z‘, ‘2‘], [‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘1‘], [‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘x‘, ‘2‘], [‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘1‘], [‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘y‘, ‘2‘], [‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘1‘], [‘z‘, ‘2‘, ‘y‘, ‘1‘, ‘z‘, ‘2‘], [‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘1‘], [‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘x‘, ‘2‘], [‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘1‘], [‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘y‘, ‘2‘], [‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘1‘], [‘z‘, ‘2‘, ‘y‘, ‘2‘, ‘z‘, ‘2‘], [‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘1‘], [‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘x‘, ‘2‘], [‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘1‘], [‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘y‘, ‘2‘], [‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘1‘], [‘z‘, ‘2‘, ‘z‘, ‘1‘, ‘z‘, ‘2‘], [‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘1‘], [‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘x‘, ‘2‘], [‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘1‘], [‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘y‘, ‘2‘], [‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘1‘], [‘z‘, ‘2‘, ‘z‘, ‘2‘, ‘z‘, ‘2‘]]
通过打印两个关键列表,看懂了,pools是把两个字符串分割成两个元组重复了三遍,result为列表推导式,先执行后面的for循环,等于是把result中的6个元组里的元素分别组合了一遍成为一个个列表,整体是个二维列表,最后的for循环yield把二维列表中的一个个列表变为元组
标签:color for循环 元素 result int yield repeat 一个个 print
原文地址:https://www.cnblogs.com/miaoweiye/p/12604590.html