1 回答
TA贡献1829条经验 获得超9个赞
html = '''<dd><p class="Definition"><span class="DefinitionTerm"><df>Example Term</df> </span>Here is the meaning of my term and its description; (<span class="TermLink">définition</span>)</p></dd><dd><p class="Definition"><span class="DefinitionTerm"><df>Example Term 2</df></span>Here is the meaning of my term 2 and its description; (<span class="TermLink">définition</span>)</p></dd><dd><p class="Definition"><span class="DefinitionTerm"><df>Example Term 3</df></span>Here is the meaning of my term 3 and its description; (<span class="TermLink">définition</span></p></dd>'''
soup = BeautifulSoup(html, 'html.parser')
for each in soup.findAll('p', class_='Definition'):
print(each.get_text())`
添加回答
举报