def get_rows(rows, header):
 header = [x.text_content().strip() for x in header]
 keyed_rows = []
 for r in rows:
  dict_row = {}
  for (k, v) in zip(header, r.xpath('td')):
   dict_row.update({k: v})
  keyed_rows.append(dict_row)
 return keyed_rows

def get_rows ( rows , header ) : header = [ x . text_content ( ) . strip ( ) for x in header ] keyed_rows = [ ] for r in rows : dict_row = { } for ( k , v ) in zip ( header , r . xpath ( 'td' ) ) : dict_row . update ( { k : v } ) keyed_rows . append ( dict_row ) return keyed_rows
takes the rows and header and returns a dict for each row with { key : <td> } .