'Pull Title attribute with out .get("title")

I'm having value like

<a href="/for-sale/property/abu-dhabi/page-3/" title="Next" class="b7880daf"><div title="Next" class="ea747e34 ">

I need to pull out only ""Next" from title="Next" for the one i used

soup.find('a',attrs={"title": "Next"}).get('title')

is there any method to get the tittle value with out using .get("title")

My code

next_page_text = soup.find('a',attrs={"title": "Next"}).get('title')

Output:

Next

I need:

next_page_text = soup.find('a',attrs={"title": "Next"})

Output:

Next

Please let me know if there is any method to find.



Solution 1:[1]

I'm re-writing my answer as there was confusion in your original post.

If you'd like to take the URL associated with the Next tag:

soup.find('a', title='Next')['href']

['href'] can be replaced with any other attribute in the element, so title, itemprop etc.

If you'd like to select the element with Next in the title:

soup.find('a', title='Next')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1