【发布时间】:2020-06-11 02:35:08
【问题描述】:
<tr>
<td width="120" align="right" class="tit">Bank:</td>
<td><span style="text-decoration: underline;color: #0066ff;cursor: pointer" onclick="_search('ad','2016.11.22');">2016.11.22</span></td>
</tr>
<tr>
<td width="120" align="right" class="tit">Shop:</td>
<td>CN108084067B</td>
</tr>
如何使用 Xpath 来获得名称“Shop”?我使用下面的代码不起作用。
number3 = html.xpath('//tr[contains(text(),"Bank")]/following-sibling::tr[1]/td/text()')[0]
【问题讨论】:
-
你的问题不清楚:选择“Shop”的依据是什么?是不是因为在第二个
<tr>,第一个跟在“Bank”后面的,还有别的原因?