python2使用beautifulsoup选择链接

2024-04-25 19:48:38 发布

您现在位置:Python中文网/ 问答频道 /正文

如何在python中使用beautifulsoup选择链接“https://www.jmir.org/2018/1/e1”?你知道吗

<a ng-href="https://www.jmir.org/2018/1/e1" ng-bind-
html="toTrust(article._data.title)" class="ng-binding" 
href="https://www.jmir.org/2018/1/e1">A Perioperative eHealth Program to 
Enhance Postoperative Recovery After Abdominal Surgery: Process Evaluation of 
a Randomized Controlled Trial</a>

我尝试了下面的代码,但是它返回时没有我想要的上面的链接。你知道吗

for i in soup.find_all('a', href=True):
    print i["href"]

Tags: httpsorgdatatitlebind链接htmlwww