[英]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:健康)状况:
It can have ERJ 3R BD1002V, but not 3R ERJ BD1002V.它可以有ERJ 3R BD1002V,但不能有3R ERJ BD1002V。
Thank you so much.太感谢了。
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.