我從我的數據庫薩姆日期,並把他們的詞典,例如:排列或組合數據蟒蛇
{1: [<Variable: Low>, <Variable: Medium>, <Variable: High>]}
{2: [<Variable: Low>, <Variable: Medium>, <Variable: High]}
{3: [<Variable: Low>, <Variable: Medium>, <Variable: High]}
在我的問題,我需要插值這個變量,並作爲最終結果,我想:
{1:High,2:High,3:High},{1:High,2:High,3:Medium}{1:High,2:High,3:Low}
{1:High,2:Medium,3:High},{1:High,2:Medium,3:Medium},{1:High,2:Medium,3:Low},
{1:High,2:Low,3:High},{1:High,2:Low,3:Medium},{1:High,2:Low,3:Low},
{1:Medium,2:High,3:High},{1:Medium,2:High,3:Medium}{1:Medium,2:High,3:Low}
{1:Medium,2:Medium,3:High},{1:Medium,2:Medium,3:Medium},{1:Medium,2:Medium,3:Low},
{1:Medium,2:Low,3:High},{1:Medium,2:Low,3:Medium},{1:Medium,2:Low,3:Low},
{1:Low,2:High,3:High},{1:Low,2:High,3:Medium}{1:Low,2:High,3:Low}
{1:Low,2:Medium,3:High},{1:Low,2:Medium,3:Medium},{1:Low,2:Medium,3:Low},
{1:Low,2:Low,3:High},{1:Low,2:Low,3:Medium},{1:Low,2:Low,3:Low}
任何人都有一些想法如何做到這一點?
注意I:詞典的數量和變量的數量可能不同。
注意二:代碼不符合標準,這只是想法。
這是組合,而不是插值。使用** itertools **包。 – Prune
除此之外,我完全不知道你在做什麼。您發佈的代碼不是合法的Python。 – Prune