如何在lxml中根据子节点选择父节点?

2024-05-16 13:59:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我有这个密码:

<table cellspacing="1" cellpadding="1" border="0">
  <tbody>
   <tr>
    <td>Something else</td>
   </tr>
   <tr>
    <td valign="top">
      <a href="http://exact url">Something</a>
    </td>
    <td valign="top">Something else</td>
   </tr>
  </tbody>
</table>

我想找到这个表,但很难找到它的目标(同样的代码使用了10次)。但我知道网址里有什么。那我怎么才能拿到父母的桌子呢?


Tags: http密码toptableelsetrsomethingexact