Issue
is there a way to get the value between the anchor tags? so in this case 'Bjelica, Nemanja' using beautiful soup?
<a href="/wiki/Nemanja_Bjelica" title="Nemanja Bjelica">Bjelica, Nemanja</a>
I tried to do it like this
name = k.find('a')['title']
but i want to get the name between the anchor tags. Any hints?
Solution
It's called the text content of a tag. As one of commenter mentioned, you can use .text
, but I personally prefer .get_text()
[which actually gets called to generate .text
anyway] because it lets you add separators for keeping texts from multiple inline elements getting smushed together. You can check out the documentation for more examples and options.
Answered By - Driftr95
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.