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"]