On Jan 23, 3:02 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jan 24, 6:57 am, ryan k <[EMAIL PROTECTED]> wrote: > > > So yea i will just have to count dashes. > > Read my lips: *you* counting dashes is dumb. Writing your code so that > *code* is counting dashes each time it opens the file is smart.
Okay it's almost working ... new parser function: def _load_table(self): counter = 0 for line in self.table_fd: # Skip the second line if counter == 0: # This line contains the columns, parse it column_list = line.split() elif counter == 1: # These are the dashes line_l = line.split() column_width = [len(i) for i in line_l] print column_width else: # This is a row, parse it marker = 0 row_vals = [] for col in column_width: start = sum(column_width[:marker]) finish = sum(column_width[:marker+1]) print line[start:finish].strip() row_vals.append(line[start:finish].strip()) marker += 1 self.rows.append(Row(column_list, row_vals)) counter += 1 Something obvious you can see wrong with my start finish code? ['rimon', 'rimon', 'Barr', 'Rimon', '22 Greenside Cres., Thornhill, ON L3T 6W9', '2', '', 'm', '102', '100 -', '22.13 1234567890', '[EMAIL PROTECTED]', ''] ['UNAME', 'PASSWD', 'LNAME', 'FNAME', 'ADDR', 'ZONE', 'SEX', 'AGE', 'LIMIT', 'BALANCE', 'CREDITCARD', 'EMAIL', 'ACTIVE'] -- http://mail.python.org/mailman/listinfo/python-list