I want to get all the <a>
tags which are children of <li>
:
<div>
<li class="test">
<a>link1</a>
<ul>
<li>
<a>link2</a>
</li>
</ul>
</li>
</div>
I know how to find element with particular class like this:
soup.find("li", { "class" : "test" })
But I don't know how to find all <a>
which are children of <li class=test>
but not any others.
Like I want to select:
<a>link1</a>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…