Ich bin neu in Python und ich habe versucht, Links zu erhalten und inneren Text aus HTML-Code:Python BeautifulSoup alle href bei Kindern von div bekommen
<div class="someclass">
<ul class="listing">
<li>
<a href="http://link1.com" title="">title1</a>
</li>
<li>
<a href="http://link2.com" title="">title2</a>
</li>
<li>
<a href="http://link3.com" title="">title3</a>
</li>
<li>
<a href="http://link4.com" title="">title4</a>
</li>
</ul>
</div>
Ich mag nur und alle Links von href http://link.com
und der innere Text title
ich diesen Code versucht
div = soup.find_all('ul',{'class':'listing'})
for li in div:
all_li = li.find_all('li')
for link in all_li.find_all('a'):
print(link.get('href'))
aber kein Glück kann jemand hel p me