Python 使用beautifulsoup查找所有强标记将返回空数组
我想提取强标记中包含的所有字符串,并将它们保存在文件中。但我无法提取强标签;它只返回空数组。我遗漏了什么吗。以下是我使用的代码: 输入: 最后一条语句的输出:Python 使用beautifulsoup查找所有强标记将返回空数组,python,beautifulsoup,Python,Beautifulsoup,我想提取强标记中包含的所有字符串,并将它们保存在文件中。但我无法提取强标签;它只返回空数组。我遗漏了什么吗。以下是我使用的代码: 输入: 最后一条语句的输出: [] 谢谢,事实上,汤里没有浓烈的标签 在浏览器中打开url时,可以得到两个强标记。但我认为你不需要它们 <li xmlns="http://www.w3.org/1999/xhtml">Check the address for typing errors such as <strong>ww</stro
[]
谢谢,事实上,汤里没有浓烈的标签
在浏览器中打开url时,可以得到两个强标记。但我认为你不需要它们
<li xmlns="http://www.w3.org/1999/xhtml">Check the address for typing errors such as
<strong>ww</strong>.example.com instead of
<strong>www</strong>.example.com</li>
产出:
['Ablation','Advance Directive (living will)','Aerobic Exercise', ...]
源代码中是否有强标记?我跟踪了你的链接,但在强标记中没有看到任何内容。@meisen99你是对的,我需要查找而不是
[tag.text.strip().replace(':',"") for tag in soup.find_all('b')]
['Ablation','Advance Directive (living will)','Aerobic Exercise', ...]