简体   繁体   English

Python 能否根据给定标准生成所有可能零件号的列表?

[英]Can Python generate list of all possible part numbers with given criteria?

I am new to Python. As in really new, just venturing if I can use this language in my work.我是 Python 的新手。就像真正的新手一样,如果我可以在我的工作中使用这种语言,那就冒险吧。

Can Python generate all the possible part numbers from this list? Python 能否从此列表中生成所有可能的部件号?

Condition:健康)状况:

  1. Characters are ordered字符是有序的

It can have ERJ 3R BD1002V, but not 3R ERJ BD1002V.它可以有ERJ 3R BD1002V,但不能有3R ERJ BD1002V。

Thank you so much.太感谢了。

PartNumbers零件号

Yes it can, except for the resistance values part (8,9,10,11) since those can be a whole list of values and the link you provided doesn't list them.是的,它可以,除了电阻值部分 (8,9,10,11),因为它们可以是一个完整的值列表,而您提供的链接没有列出它们。

Here is a simple code to do it.这是一个简单的代码来做到这一点。 It will put RRRR into the resistance value part.它将RRRR放入电阻值部分。 If you have a list of resistance values, just add them to list R and it will use those to create the combinations:如果您有电阻值列表,只需将它们添加到列表R ,它将使用这些值来创建组合:

B = ['1R','2R','3R','6R']
C = ['H','B','K', 'E']
R = ['RRRR']
V = {'1R': 'C', '2R': 'x', '3R': 'V', '6R': 'V'}

for bi in B:
    for ci in C:
        for ri in R:
            print ('ERJ '+ bi + ' ' + ci + ' D ' + ri + ' ' + V[bi])

I put in extra spaces between sections for clarity but you can remove them if you like为了清楚起见,我在各部分之间放置了额外的空格,但如果您愿意,可以删除它们

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

相关问题 Python在“面板”上生成所有可能的数字配置 - Python generate all possible configurations of numbers on a “board” 从 python 中的数字列表给出的分布生成随机数 - Generate random numbers from a distribution given by a list of numbers in python 生成符合 Python 标准的数字 - Generate numbers that meet criteria in Python 在python中生成所有3位回文数的列表 - Generate list of all palindromic numbers of 3 digits in python 快速 python 算法,用于从子集总和等于给定比率的数字列表中找到所有可能的分区 - Fast python algorithm to find all possible partitions from a list of numbers that has subset sums equal to given ratios 对给定列表Python的给定范围内的所有数字求和 - Sum all numbers in a given range of a given list Python 在Python中生成所有可能映射的列表 - Generate the list of all possible mappings in Python 如何根据数字输入生成所有可能的字母组合的列表 - How to generate a list of all possible alphabetical combinations based on an input of numbers 从数字列表中生成所有可能组合的百分比 - Generate a percent of all possible combinations from a list of numbers 如何从数字列表中生成所有可能的最大堆? - How to generate all possible max-heaps from a list of numbers?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM