def parse_table(table):
  head0=htmltable2matrix(table,cell_xpath='b/text()')[0]
  head1=htmltable2matrix(table,cell_xpath='descendant::img/@alt')[1]
  keys=[clean_whitespace(':'.join(col)) for col in zip(head0,head1)]

  body=htmltable2matrix(table,cell_xpath='text()')
  rows=[dict(zip(keys,row)) for row in body[2:len(body)]]
  for row in rows:
    del(row[':'])

  return rows
def parse_table(table):
    head0 = htmltable2matrix(table, cell_xpath='b/text()')[0]
    head1 = htmltable2matrix(table, cell_xpath='descendant::img/@alt')[1]
    keys = [clean_whitespace(':'.join(col)) for col in zip(head0, head1)]

    body = htmltable2matrix(table, cell_xpath='text()')
    rows = [dict(zip(keys, row)) for row in body[2:len(body)]]
    for row in rows:
        del (row[':'])

    return rows
Ejemplo n.º 3
0
 def setUp(self):
     self.table_xml = get_table()
     self.table_matrix = htmltable2matrix(self.table_xml)
Ejemplo n.º 4
0
 def setUp(self):
   self.table_xml=get_table()
   self.table_matrix=htmltable2matrix(self.table_xml)