Check with BeautifulSoup if a html page doesn't contain a certain string

Viewed 7280

I know is possible look for a string in a html page with BeautifulSoup using findAll function. If the target is the BeautifulSoup site, for instance:

page = urllib2.urlopen('https://www.crummy.com/software/BeautifulSoup/bs4/doc/')

soup = BeautifulSoup(page, "html.parser")

print soup.findAll(text="python")

The result would be:

[u'python']

But how do I check to see if there wasn't any occurences? Is it possible to have a boolean result?

1 Answers
Related