问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/23584658/beautifulsoup-find-table-by-style