Is it possible to find a specific table with unique style?
Say, given the following html:
<table border="1" style="background-color:White;font-size:10pt;border-collapse:collapse;">
How can I use BS to find that table?
Thanks
Try it:
from bs4 import BeautifulSoup
bs = BeautifulSoup(htmlcontent)
bs.find_all('table', attrs={'border': '1' ,'style':'background-color:White;font-size:10pt;border-collapse:collapse;'})
Check this link for more details.
import requests
from bs4 import BeautifulSoup
r = requests.get("https://www.lipsum.com/")
soup = BeautifulSoup(r.content,"lxml")
print(soup.find_all('div',style=lambda value: value and 'text-align:justify' in value))
Note: important use attrs for class !!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With