BeautifulSoup - 提取属性值 [英] BeautifulSoup - extracting attribute values
本文介绍了BeautifulSoup - 提取属性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果美丽的汤给我一个锚标记是这样的:
If Beautiful Soup gives me an anchor tag like this:
<a class="blah blah" id="blah blah" href="link.html"></a>
我将如何检索的href
属性的值?
推荐答案
如果您已经拥有了锚,抢的href
属性是这样的:
If you already have the anchor, grab the href
attribute like this:
href = anchor["href"]
这篇关于BeautifulSoup - 提取属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文