Answers for "how to select tags from with in another tag in beautifulsoap"

0

how to select tags from with in another tag in beautifulsoap

from bs4 import BeautifulSoup

soup = BeautifulSoup(SomePage, 'lxml')
html = soup.find('div', class_='base class')
print(html)

<div class="base class">
  <div>Sample text 1</div>
  <div>Sample text 2</div>
  <div>
    <a class="ordinary link" href="https://example.com">URL text</a>
  </div>
</div>

<div class="Confusing class"></div>
'''
Posted by: Guest on March-20-2021
0

how to select tags from with in another tag in beautifulsoap

a_tag = html.a
link = a_tag['href']
print(link)

https://example.com
Posted by: Guest on March-20-2021

Code answers related to "how to select tags from with in another tag in beautifulsoap"

Browse Popular Code Answers by Language