我想从网站上刮掉球员名单,但名字都在标签上。我不知道如何刮标签上的文字。 这里是链接 https://athletics.baruch.cuny.edu/sports/mens-swimming-and-diving/roster 例如,从html我们有 如何从标签中刮取文本
<div class="sidearm-roster-player-image column">
<a data-bind="click: function() { return true; }, clickBubble: false" href="/sports/mens-swimming-and-diving/roster/gregory-becker/3555" aria-label="Gregory Becker - View Full Bio" title="View Full Bio">
<img class="lazyload" data-src="/images/2018/10/19/GREGORY_BECKER.jpg?width=80" alt="GREGORY BECKER">
</a>
</div>
下面是帮助您从a标记中提取名称的代码
您可以在BeautifulSoup中使用
.get()
方法。首先使用任何选择器或find/find_all
选择elem
中的元素或任何其他变量。然后尝试:相关问题 更多 >
编程相关推荐