Hi list,
I'm trying to test for the existence of a href tag in some HTML. Looking
at the docs, this should be nice and easy:
http://www.crummy.com/software/BeautifulSoup/bs4/doc/#css-selectors
I have the following code:
print(item)
print(type(item))
print(item.select_one('a'))
which outputs:
<a
href="
http://www.example.com/display/87/Specialist.html?Id=1442798&page=1"><span
class="strong">Specialist</span></a>
<class 'bs4.element.Tag'>
None
As you can see, the variable is a bs4.element.Tag, and it definitely has
a value of "href", but it's not being found. In fact, no matter what I
enter into either the select_one or select methods, the output is always
None or [] respectively. I've tried: 'span' and 'a' too, but to no avail.
Any suggestions? Am I doing something wrong?
Python 3.3, with BS 4.
Thanks