1
我有一個像查找xapth在beautifulsoup獲得目標標籤
<html>
<body>
<-- Some tags -->
<div class="main-sv">
<div class="first-sv custom-sv">
<-- Some tags and content-->
</div>
</div>
</body>
</html>
我想看看如果div
這類值爲main-sv
和兒童標籤的div和第一個孩子的類值類值包含HTML結構First-sv
子字符串。
繼在我的代碼,做工精細
>>> "Frist-sv" in dict(soup.find("div", {"class" :"main-sv"}).findChild().attrs)["class"].split(" ")
True
還是喜歡在lxml
xpath
任何其他方式?
我不得不使用beautifulsoup只有