beautifulsoup查找标签

mac2022-06-30  80

soup = BeautifulSoup('demo.html', 'html.parser')

soup.find_all('p', attrs={'class':'button', 'color':'black'}

若要找某个属性却不知道属性值的,则可以这样写

soup.find_all('p', attrs={'class':'button', 'color':'black', 'size':True}

转载于:https://www.cnblogs.com/chimmu/p/6212320.html

最新回复(0)