I'm working with beautiful soup and am trying to grab the first tag on a page that has the attribute equal to a certain string.
For example:
<a href="url" title="export"></a>
What I've been trying to do is grab the href of the first that is found whose title is "export".
- If I use
soup.select("a[title='export']")then I end up finding all tags who satisfy this requirement, not just the first. If I use
find("a", {"title":"export"})with conditions being set such that the title should equal "export", then it grabs the actual items inside the tag, not the href.If I write
.get("href")after callingfind(), I get None back.
I've been searching the documentation and stack overflow for an answer but have yet found one. Does anyone know a solution to this? Thank you!