6 tempfile
=open('workfile', 'w')
14 for line
in fileinput
.input():
16 if re
.search("uref=",text
):
17 word_length
= len(text
) - 1 #remove newline
18 uref
= text
[5:word_length
] #get component uref
20 if re
.search("value=",text
):
21 word_length
= len(text
) - 1 #remove newline
22 value
= text
[6:word_length
] #get component value
27 tempfile
.write(' ---------- ')
33 print fileinput
.filename()
35 x
= open('workfile','r')
37 pp
=fileinput
.filename()
39 bom
=open(pp
+'.bom','w')
41 bom
.write("Bill of Materials for "+ fileinput
.filename() + '\n')
43 bom
.write("Component Value\n")
52 bom
= open(pp
+ '.bom','r')
53 for line
in bom
.readlines():
56 commands
.getoutput('rm workfile') #remove workfile