Is there a way to get all values of a certain attribute?
Example:
<a title="title-in-a">
<b title="title-in-b"> ... </b>
<c title="title-in-c"> ... </c>
<d name="i-dont-care"> ... </d>
</a>
Can I get all titles, even if they are in different tags?
Expected result:
['title-in-a', 'title-in-b', 'title-in-c']
To get all titles in <a>
, I know I can do this:
for item in soup.find_all('a'):
print item['title']
But how to do it for all tags, even without knowing the tags?