I am currently trying to extract all data from a table. Table data rows are formatted as <td headers="h1" align="left"></td>
when there is no data.
Using the etree.tostring()
method from the lxml
library prints out these elements as <td headers="h1" align="left"/>
instead of the source formatting.
Furthermore, using xpath
if I run the code tree.path('//td[@headers="h1"]/text()')
the resulting list does not include blank values where there is no data.
As I am trying to write these results to a CSV file, how do I include NULL, i.e. ""
when there is no data?