我试图使用Python 3从Result中提取'Total Marks'。网页显示在image中,从这里我试图提取数据''。被示出(从萤火虫)的内容的XPath的为:XPath不返回内容
/html/body/div/div/div/div[3]/div[1]/div/div[2]/div[2]/table/tbody/tr[1]/td[2]/b
使用的代码段是:
summary_data_xpath = '//tbody/tr[1]/td[2]/b/text()'
data = html_tree.xpath(summary_data_xpath)
print(data)
但是我得到的输出:[]
我使用绝对路径尝试(由Firebug给出的XPath)。我也尝试从'//table
'开始参考,但我得到了相同的结果。
两个表的结构如下:
...
<div>
<div>
Upper Table with subject marks
</div>
Lower Table with subject marks and division
</div>
...
我如何可以提取总表标记 ''? 在此先感谢您的帮助!
非常感谢您的回复瞬间。它像一个魅力。 – Aadarsha