Python lists

Manatee markrivet at gsoftcon.com
Fri Dec 28 09:14:57 EST 2012


I read in this:
['C100, C117', 'X7R 0.033uF 10% 25V  0603', '0603-C_L, 0603-C_N', '10', '2', '', '30', '15463-333', 'MURATA', 'GRM188R71E333KA01D', 'Digi-Key', '490-1521-1-ND', '']

Then I need to convert it to this:
[['C100', 'C117'], 'X7R 0.033uF 10% 25V  0603', '0603-C_L', '0603-C_N', '10', '2', '', '30', '15463-333', 'MURATA', 'GRM188R71E333KA01D', 'Digi-Key', '490-1521-1-ND', '']]

The objectinve is too make the first instance a list of lists and have component values enclosed in a list. Then I will print out the components, each on its own line, followed by the description; for instance.
C100, 'X7R 0.033uF 10% 25V  0603', '0603-C_L', '0603-C_N', '10', '2', '', '30', '15463-333', 'MURATA', 'GRM188R71E333KA01D', 'Digi-Key', '490-1521-1-ND', ''
c117, 'X7R 0.033uF 10% 25V  0603', '0603-C_L', '0603-C_N', '10', '2', '', '30', '15463-333', 'MURATA', 'GRM188R71E333KA01D', 'Digi-Key', '490-1521-1-ND', ''

The file is read in from a comma delimited file. I can't seem to work this out.



More information about the Python-list mailing list