我现在脑子里有个错误。你知道吗
我有大量的变量,每个变量有两种状态。我想把它们组合成一个数组,为此我选择了itertools.产品. 你知道吗
所以基本上我需要的是
a = ["A", "a"]
b = ["B", "b"]
c = ["C", "c"]
...
result = list(itertools.product(a,b,c,...)
如果我用手写a,b,c的话,效果很好,但是写那么多会很烦人。
到目前为止,我的方法是将我的状态存储在一个字典中,然后循环更新:
dict = {1: ["A","a"], 2: ["B","b"], ..., 300: ["XYZ", "xyz"]}
现在我想把它组合起来
result = list(itertools.product([dict[i] for i in range(1,4)]))
现在我期待着
("A","B","C"),("A","B","c"),("A","b","C"),...,("a","b","c")
但是我得到了
(['A', 'a'],), (['B', 'b'],), (['C', 'c'],)
怎么会这样?我该怎么解决呢?你知道吗
Tags:
方法字典产品状态错误数组resultproductdictlistitertools手写效果xyz脑子里1条回答网友
1楼 ·
发布于 2023-03-06 22:43:04
itertools.product
接受数量可变的参数,而不是参数列表。所以,只要在列表前面放一个*
就可以打开它
itertools.product(*[dict[i] for i in range(1,4)])
SightCare formula aims to maintain 20/20 vision without the need for any surgical process. This supplement is a perfect solution for people facing issues as they grow older. https://sightcare-web.com/
Easier WWW is a leading technology site that is dedicated to produce great how-to, tips and tricks and cool software review. https://easierwww.com/
– Shoot MASSIVE Loads For An Amazing Finish! https://semenax-try.com/
MenoPhix is a menopause relief supplement featuring a blend of plant extracts to target the root cause of menopause symptoms. https://menophix-web.com/
TestRX™ is a bodybuilding supplement. It’s formulated with high-quality natural ingredients proven to boost natural testosterone and stimulate muscle growth. https://testrx-web.com/
CLINICALLY PROVEN* To Increase Semen Volume And Intensity https://semenax-try.com/
valtrex no prescription price
DuoTrim is an innovative weight loss supplement that utilizes the power of natural plants and nutrients to create CSM bacteria https://duotrim-us.com/
largestcatbreed.com
예전에는 투자자가 많았지만 지금은 가장 난처한 상황에 처해 있습니다.
k8 カジノ 出金
情報が豊富で非常に役立ちました。これからも読み続けます。
PureLumin Essence is a meticulously-crafted natural formula designed to help women improve the appearance of age spots. https://pureluminessence-web.com/
Progenifix is designed to help maximize weight loss results using a mixture of natural, science-backed ingredients. The formula also has secondary benefits, including promoting overall wellness and vitality and assisting your immune system. https://progenifix-web.com/
Gut Vita™ is a daily supplement that helps consumers to improve the balance in their gut microbiome, which supports the health of their immune system. It supports healthy digestion, even for consumers who have maintained an unhealthy diet for a long time. https://gutvita-us.com/
Fast Lean Pro is a herbal supplement that tricks your brain into imagining that you’re fasting and helps you maintain a healthy weight no matter when or what you eat. It offers a novel approach to reducing fat accumulation and promoting long-term weight management. https://fastleanpro-web.com/
PowerBite stands as an innovative dental candy, dedicated to nurturing healthy teeth and gums. Infused with a potent formula, it champions the cause of a robust and radiant smile. Crafted meticulously https://powerbite-web.com/
Boostaro is a dietary supplement designed specifically for men who suffer from health issues. https://boostaro-try.com/
Carbofix is the revolutionary dietary formula that promises to activate weight loss without all the extra hard work. https://carbofix-try.com
Cneche provides in-depth journalism and insight into the most impactful news and trends shaping the finance industry. https://cneche.com/
Tvphc provides news and analysis for IT executives. We cover big data, IT strategy, cloud computing, security, mobile technology, infrastructure, software and more. https://tvphc.com
Sugar Defender is the rated blood sugar formula with an advanced blend of 24 proven ingredients that support healthy glucose levels and natural weight loss. https://mariscosleomar.com/
geinoutime.com
폐하께서는 죽이고 싶었지만 그것은 두려움 때문이었습니다.
В современном мире, где диплом становится началом успешной карьеры в любом направлении, многие пытаются найти максимально быстрый путь получения образования. Необходимость наличия официального документа об образовании сложно переоценить. Ведь именно диплом открывает двери перед любым человеком, который собирается начать профессиональную деятельность или учиться в университете.
В данном контексте наша компания предлагает очень быстро получить любой необходимый документ. Вы имеете возможность купить диплом, и это будет выгодным решением для всех, кто не смог завершить обучение, потерял документ или хочет исправить плохие оценки. Каждый диплом изготавливается с особой тщательностью, вниманием ко всем элементам, чтобы на выходе получился 100% оригинальный документ.
Превосходство этого решения состоит не только в том, что можно максимально быстро получить свой диплом. Процесс организовывается комфортно, с профессиональной поддержкой. От выбора подходящего образца до точного заполнения персональной информации и доставки по стране — все находится под абсолютным контролем качественных специалистов.
Всем, кто ищет максимально быстрый способ получить требуемый документ, наша услуга предлагает отличное решение. Заказать диплом – значит избежать долгого обучения и сразу перейти к своим целям, будь то поступление в ВУЗ или старт карьеры.
Купить диплом 2010 года
Sugar Defender is a revolutionary blood sugar support formula designed to support healthy glucose levels and promote natural weight loss. https://mineryuta.com
sugar defender: https://abmdds.com/
k8 カジノ 公式
情報が豊富で、とても理解しやすかったです。役立ちました!
sugar defender: https://peyfon.com/
sugar defender: https://seahorsesoap.com/
не работает
_________________
русские казино с бонусом на первый депозит – aviator официальный сайт, русские казино с минимальным депозитом
sugar defender: https://royalforestlaundry.com/
buy prednisone without a prescription
sugar defender: https://luckysloader.com/
sugar defender: https://drdenisemichele.com/
sugar defender: https://bridgerealtysc.com/