On Friday, December 28, 2012 9:14:57 AM UTC-5, Manatee wrote: > 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.
Forgot to list my code, here is my code: import csv list = [] t = [0] with open('38366 Rev 6_12_12_2012_0602pm.csv', 'rb') as f: reader = csv.reader(f) for row in reader: repeat_info = row[1:] for ref_des in row[0]: t[0] = ref_des print t + row[1:] -- http://mail.python.org/mailman/listinfo/python-list