python组件有多少个_python-计算,排序和重新排列组件

我的导入列表是包含不同组件的列表.脚本计算出有多少个相同的组件.

我正在尝试对它们进行排序,并在它们前面放置“ part”.

码:

Using code from @MagunRa

输入文件(新):

Part Value Package Library Position (mm) Orientation

C1 100n C0402 rcl (117.65 40.75) R270

C2 100n C0603 rcl (-48.26 53.34) R0

C3 1u C0402 rcl (-50.8 78.74) R0

C4 1u C0402 rcl (9 63.1) R270

C5 10n-1% C0402 rcl (81.55 39.65) R270

C6 100n C0603 rcl (-54.61 53.34) R0

C7 100n C0402 rcl (-60.96 53.34) R0

C8 100n C0603 rcl (-67.31 53.34) R0

C9 100n C0603 rcl (-73.66 53.34) R0

C10 100n C0402 rcl (117.8 50.55) R270

C11 100n C0603 rcl (-17.78 58.42) R0

C12 100n C0603 rcl (-24.13 58.42) R0

C13 1u C0402 rcl (80.35 45.95) R0

C14 100n C0402 rcl (78.15 52.75) R0

C15 1u C0402 rcl (81.5 44.1) R90

C16 10u C0402 rcl (79.25 40.75) R270

C17 22u C0603 rcl (-59.69 63.5) R0

C18 100n C0603 rcl (-36.83 58.42) R0

C19 100n C0603 rcl (-43.18 58.42) R0

C20 100n C0603 rcl (-49.53 58.42) R0

C21 100u A/3216-18R rcl (-60.96 40.64) R0

C22 100n C0402 rcl (-55.88 58.42) R0

C23 10n C0402 rcl (-64.77 63.5) R0

C24 22u C0603 rcl (-69.85 63.5) R0

C25 100n C0402 rcl (-62.23 58.42) R0

C26 10n C0402 rcl (-74.93 63.5) R0

C27 100n C0402 rcl (83.15 51.4) R0

C28 1u C0402 rcl (78.3 50.25) R180

C29 47uF C0603 rcl (-35.56 53.34) R0

C30 0.5p C0402 rcl (83.8 46.35) MR270

C31 100n C0603 rcl (-74.93 58.42) R0

C32 100n C0603 rcl (-17.78 63.5) R0

C33 10u C0402 rcl (-16.51 68.58) R0

C34 120n C0603 rcl (-24.13 63.5) R0

C34_X5R >2.2u C0402 rcl (-21.59 53.34) R0

C34_X5R1 >2.2u C0402 rcl (-80.01 48.26) R0

C35 10u C0402 rcl (-21.59 68.58) R0

C36 1u C0402 rcl (83.15 52.45) R180

C37 6.8n C0603 rcl (-34.29 63.5) R0

C40 10u C0402 rcl (83.1 42.85) MR180

C53 1u C0603 rcl (-36.83 68.58) R0

C54 12p C0603 rcl (-41.91 68.58) R0

C55 12p C0603 rcl (-46.99 68.58) R0

C56 100u A/3216-18R rcl (-66.04 40.64) R0

C57 100u A/3216-18R rcl (-71.12 40.64) R0

C58 100u A/3216-18R rcl (-76.2 40.64) R0

D1 PD3S160 POWERDI323 diode (-46.99 41.91) R0

D2 PD3S160 POWERDI323 diode (-55.88 41.91) R0

IC1 OPA333DBV SOT23-5 linear (79.2 48.1) R90

J1 MOLEX_47346-0001 Molex-47346-0001 (-39.37 17.78) R0

L3 BLM15HD182SN1 0402 inductors (-53.34 48.26) R0

L4 BLM15HD182SN1 0402 inductors (-69.85 48.26) R0

R1 33M R0603 rcl (82.65 46.3) MR90

R2 10K R0402 rcl (118.85 50.55) R270

R3 2k2 R0402 rcl (-31.75 78.74) R0

R4 10K R0402 rcl (118.85 40.75) R270

R5 10k R0402 rcl (-36.83 78.74) R0

R6 10k R0402 rcl (83.1 43.9) MR0

R7 10k R0603 resistor (-36.83 48.26) R0

R8 2k2 R0402 rcl (106.4 40.8) R90

R9 220 R0603 rcl (-26.67 78.74) R0

R10 100 R0402 rcl (107.85 43.95) R90

R11 2k2 R0402 rcl (106.4 50.65) R270

R12 100 R0402 rcl (107.85 47.45) R270

R13 4.7 R0402 rcl (81.55 41.65) R270

R14 47 R0402 rcl (115.2 40.75) R90

R15 2k2 R0402 rcl (110.85 40.75) R270

R16 47 R0402 rcl (115.2 50.55) R270

R17 10k R0603 resistor (-16.51 48.26) R0

R18 15 R0603 rcl (122.15 43.85) R90

R19 2k2 R0402 rcl (110.85 50.55) R90

R20 10 R0603 rcl (122.15 47.5) R270

R21 10k R0603 resistor (-21.59 48.26) R0

R22 4.7 R0402 rcl (79.95 39.1) R0

R23 47k R0402 rcl (78.35 51.55) R180

R24 1k R0402 rcl (77.85 54.05) R0

R27 1k R0402 rcl (82.6 45.4) R90

R28 20k R0402 rcl (78.2 45.95) R0

R29 0.2 R0603 rcl (80.4 41.1) R90

R35 10K R0402 rcl (80.45 50.25) R0

R36 10k R0603 resistor (-26.67 48.26) R0

R42 500 R0603 resistor (-31.75 48.26) R0

R48 100 R0402 rcl (116.45 40.75) R90

R49 100 R0402 rcl (116.75 50.55) R90

SOT23-1 LTC6240 SOT23-5 artinis (82.3 50.2) MR180

T1 PMV16UN SOT-23 zetex (121 40.75) R90

T2 FMMT617 SOT-23 zetex (108.6 40.85) R180

T3 FMMT717 SOT-23 zetex (-40.64 25.4) R0

T4 FMMT617 SOT-23 zetex (108.6 50.55) R0

T5 PMV16UN SOT-23 zetex (121 50.55) R90

T6 FMMT617 SOT-23 zetex (113 40.65) R0

T8 FMMT617 SOT-23 zetex (113.05 50.65) R180

U$1 BPW34SMD BPW_34_SMD jwasys (80 45.7) MR180

U$2 TPS73433 SOT23-5 artinis (-48.26 15.24) R0

U$4 LED760/850_ROITHNER DUOLED_5MM jwasys (110 45.7) R90

U$5 LED760/850_ROITHNER DUOLED_5MM jwasys (115 45.7) R90

U$6 LED760/850_ROITHNER DUOLED_5MM jwasys (120 45.7) R90

U$7 TM4C123GH6ZRBBGA157 BGA_157_MICROSTAR artinis (-26.67 6.35) R0

U$8 REF3225 SOT95P280X100-6N artinis (82.95 48.95) R90

U$10 TPS73633 SOT23-5 artinis (-55.88 15.24) R0

U$12 BNO055LGA-28 LGA-28 artinis (-59.69 78.74) R0

U$14 ECX-42_CRYSTALECS-160-9-42-CKM-TR ECX-42_CRYSTAL artinis (-67.31 77.47) R0

U$16 HEADER_1.27_7 HEADER_1.27_7 jwasys (-73.66 77.47) R0

U1 ADS8860 SOP50P490X110-10N artinis (85.3 40.35) R0

U6 THS4281DBVT SOT95P280X145-5N artinis (78.85 43.85) R180

代码输出(MagunRa):

Part - Value - Package - Amount

['R29'],0.2,R0603,1

['C30'],0.5p,C0402,1

['R20'],10,R0603,1

['R10', 'R12', 'R48', 'R49'],100,R0402,4

['C1', 'C2', 'C6', 'C7', 'C8', 'C9', 'C10', 'C11', 'C12', 'C14', 'C18', 'C19', 'C20', 'C22', 'C25', 'C27', 'C31', 'C32'],100n,C0402,7

['C1', 'C2', 'C6', 'C7', 'C8', 'C9', 'C10', 'C11', 'C12', 'C14', 'C18', 'C19', 'C20', 'C22', 'C25', 'C27', 'C31', 'C32'],100n,C0603,11

['C21', 'C56', 'C57', 'C58'],100u,A/3216-18R,4

['R2', 'R4', 'R35'],10K,R0402,3

['R5', 'R6', 'R7', 'R17', 'R21', 'R36'],10k,R0402,2

['R5', 'R6', 'R7', 'R17', 'R21', 'R36'],10k,R0603,4

['C23', 'C26'],10n,C0402,2

['C5'],10n-1%,C0402,1

['C16', 'C33', 'C35', 'C40'],10u,C0402,4

['C34'],120n,C0603,1

['C54', 'C55'],12p,C0603,2

['R18'],15,R0603,1

['R24', 'R27'],1k,R0402,2

['C3', 'C4', 'C13', 'C15', 'C28', 'C36', 'C53'],1u,C0402,6

['C3', 'C4', 'C13', 'C15', 'C28', 'C36', 'C53'],1u,C0603,1

['R28'],20k,R0402,1

['R9'],220,R0603,1

['C17', 'C24'],22u,C0603,2

['R3', 'R8', 'R11', 'R15', 'R19'],2k2,R0402,5

['R1'],33M,R0603,1

['R13', 'R22'],4.7,R0402,2

['R14', 'R16'],47,R0402,2

['R23'],47k,R0402,1

['C29'],47uF,C0603,1

['R42'],500,R0603,1

['C37'],6.8n,C0603,1

['C34_X5R', 'C34_X5R1'],>2.2u,C0402,2

['U1'],ADS8860,SOP50P490X110-10N,1

['L3', 'L4'],BLM15HD182SN1,0402,2

['U$12'],BNO055LGA-28,LGA-28,1

['U$1'],BPW34SMD,BPW_34_SMD,1

['U$14'],ECX-42_CRYSTALECS-160-9-42-CKM-TR,ECX-42_CRYSTAL,1

['T2', 'T4', 'T6', 'T8'],FMMT617,SOT-23,4

['T3'],FMMT717,SOT-23,1

['U$16'],HEADER_1.27_7,HEADER_1.27_7,1

['U$4', 'U$5', 'U$6'],LED760/850_ROITHNER,DUOLED_5MM,3

['SOT23-1'],LTC6240,SOT23-5,1

['J1'],MOLEX_47346-0001,Molex-47346-0001,1

['IC1'],OPA333DBV,SOT23-5,1

['D1', 'D2'],PD3S160,POWERDI323,2

['T1', 'T5'],PMV16UN,SOT-23,2

['U$8'],REF3225,SOT95P280X100-6N,1

['U6'],THS4281DBVT,SOT95P280X145-5N,1

['U$7'],TM4C123GH6ZRBBGA157,BGA_157_MICROSTAR,1

['U$2'],TPS73433,SOT23-5,1

['U$10'],TPS73633,SOT23-5,1

我试图得到的输出:

Part - Value - Package - Amount

[C1,C7,C10,C14,C22,C25,C27],100n,C0402,7

Etc,

Etc,

正如您在文件中看到的那样,该零件以字母开头:C,D,R,L等.

是否可以对其进行排序,以便按字母顺序显示?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值