码迷,mamicode.com
首页 > 其他好文 > 详细

待填坑

时间:2020-03-31 14:37:53      阅读:48      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!