繁体   English   中英

列表列表python递归置换

[英]Lists of lists python recursive permutation

您如何以特定方式操纵字符串列表,以便

lst = [ [a, b], [c, d, e], [f, a, e] ]
# turns into
lst = [ [a, b], [b, a], [c, d, e], [c, e, d], [d, c, e],etc...]
#there are 14 combinations
from itertools import *

combo_list = []

for i in your_list:
    for j in permutations(i, len(i)):
        combo_list.append(j)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM