views:

120

answers:

2

If Beautiful Soup gives me an anchor tag like this:

<a class="blah blah" id="blah blah" href="link.html"></a>

How would I retrieve the value of the href attribute?

+3  A: 

If you already have the anchor, grab the href attribute like this:

href = anchor["href"]
Andrew Hare
+1  A: 

See "The Attributes of Tags" in the documentation.

Craig McQueen