在 Python 中使用 BeautifulSoup 解析数据 [英] Parsing out data using BeautifulSoup in Python
本文介绍了在 Python 中使用 BeautifulSoup 解析数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 BeautifulSoup 解析 DOM 树并提取作者姓名.下面是一段 HTML 代码,用于显示我将要抓取的代码的结构.
<身体><div class="list-authors"><span class="descriptor">作者:</span><a href="/find/astro-ph/1/au:+Lin_D/0/1/0/all/0/1">林大成</a>,<a href="/find/astro-ph/1/au:+Remillard_R/0/1/0/all/0/1">Ronald A. Remillard</a>,<a href="/find/astro-ph/1/au:+Homan_J/0/1/0/all/0/1">Jeroen Homan</a>
<div class="list-authors"><span class="descriptor">作者:</span><a href="/find/astro-ph/1/au:+Kosovichev_A/0/1/0/all/0/1">A.G.科索维奇夫
<!--还有许多其他具有这种结构的 div 标签-->