我有以下几点
<ul class="fullname">
<li><a href="">some name</a></li>
<li>
<ul>
<li>name1</li>
<li>Name2</li>
</ul>
</li>
<ul>
<li>name3</li>
<li>Name4</li>
</ul>
</li>
</ul>
我只想要三个元素,在第一个索引中,比如
<li><a href="">some name</a></li>
和第二<ul><li>name1</li><li>Name2</li></ul>
我试过以下方法
navContent = content.find("li",{"class":"fullname"})
children = navContent.find_all("li")
但是在第二个索引中,它给出的是<li>name1</li>
,而不是整个li
。我怎样才能得到它?你知道吗
使用^{}
根据文件:
相关问题 更多 >
编程相关推荐