【发布时间】:2020-07-22 14:17:52
【问题描述】:
我怎样才能只从下面的 html 中得到 Rodger Federer 这个词
<div class="profile-heading--desktop"><h1><span class="profile-heading__rank">#1 </span>Roger Federer</h1><div class="profile-subheading">Athlete, Tennis</div></div>
我正在使用此代码
name = soup.find(class_ = 'profile-heading__rank').get_text()
而且越来越 #1
【问题讨论】:
-
如果您使用的代码是 Python,则值得将其(以及适当的版本)添加为标签。
标签: html css python-3.x beautifulsoup