【发布时间】:2022-11-19 15:34:14
【问题描述】:
我想从 'p' 中提取 'span' 标签,但我不知道该怎么做
html = "
<div id="tab-description" class="plugin-description section">
<h2 id="description-header">Description</h2>
<p><span class="embed-youtube" style="text-align:center; display: block;"><iframe class="youtube-player"src="https://www.youtube.com/"></iframe></span></p>
</div>
"
soup = BeautifulSoup(html,'lxml')
description = soup.find(id="tab-description").find('p')
我尝试decompose()它但返回错误。
【问题讨论】:
标签: python html web-scraping beautifulsoup