How to find tags with only certain attributes - BeautifulSoup

后端 未结 6 790
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 05:23

How would I, using BeautifulSoup, search for tags containing ONLY the attributes I search for?

For example, I want to find all

6条回答
  •  独厮守ぢ
    2020-11-28 05:38

    The easiest way to do this is with the new CSS style select method:

    soup = BeautifulSoup(html)
    results = soup.select('td[valign="top"]')
    

提交回复
热议问题