1

When I search for tags which contain specific text in BeautifulSoup, I use find_all(string='text I want'):

soup = BeautifulSoup('<a id="someid">stackoverflow</a>', 'lxml')
soup.find_all(string='stackoverflow')

But I recently found that I can do so by

soup.find_all(text='stackoverflow')

I went over the documentation for BeautifulSoup 4, but I couldn't find any clue on find_all with text argument.

Is there any difference?

nhtrnm
  • 1,411
  • 3
  • 15
  • 24

1 Answers1

3

From the docs:

With string you can search for strings instead of tags. The string argument is new in Beautiful Soup 4.4.0. In earlier versions it was called text.

avip
  • 1,445
  • 13
  • 14