I have an html code like this:
My HomePage
<
You can do something like this:
import BeautifulSoup html = """ My HomePage Sections """ soup = BeautifulSoup.BeautifulSoup(html) print [elm.a.text for elm in soup.findAll('h2', {'class': 'title'})] # Output: [u'My HomePage', u'Sections']