python, lxml and xpath - html table parsing
问题 I 'am new to lxml, quite new to python and could not find a solution to the following: I need to import a few tables with 3 columns and an undefined number of rows starting at row 3. When the second column of any row is empty, this row is discarded and the processing of the table is aborted. The following code prints the table's data fine (but I'm unable to reuse the data afterwards): from lxml.html import parse def process_row(row): for cell in row.xpath('./td'): print cell.text_content()