【发布时间】:2019-09-22 23:59:29
【问题描述】:
这是我正在处理的 HTML 源代码:
<a href="/people/charles-adams" class="gridlist__link">
所以我想做的是提取 href 属性,在这种情况下是“/people/charles-adams”,带有beautifulsoup 模块。我需要这个,因为我想用 soup.findAll 方法获取该特定网页的 html 源代码。但我正在努力从网页中提取此类属性。谁能帮我解决这个问题?
附: 我正在使用这种方法通过 Python 模块 beautifulSoup 获取 html 源代码:
request = requests.get(link, headers=header)
html = request.text
soup = BeautifulSoup(html, 'html.parser')
【问题讨论】:
标签: python html web-scraping beautifulsoup