我试图应用其他人的建议:
Beautiful Soup: Accessing <li> elements from <ul> with no id
但我不能让它工作。看来那个问题的人
'parent'h2
头,但我试图解析的那个没有。你知道吗
这是我正在刮的网页:
(我想)我找到了我需要操纵的元素,它是<ul id="latestVulns">
和它下面的li
部分。你知道吗
我基本上是想勉强找到“最近20个得分的漏洞ID和摘要”一节,并根据漏洞是什么,向我工作场所的相应部门发送电子邮件。你知道吗
以下是我目前的代码:
from bs4 import BeautifulSoup
import requests
source = requests.get('https://nvd.nist.gov/')
soup = BeautifulSoup(source.content, 'lxml')
section = soup.find('latestVulns')
print(section)
此代码不返回任何值
我不知所措
find
的第一个参数需要元素的名称,您正在传递id
。你知道吗您可以使用它来正确地查找标记
find
的第一个参数需要元素的名称,您正在传递id
。你知道吗您可以使用它来正确地查找标记
相关问题 更多 >
编程相关推荐