How to find <tag> to </tag> HTML strings and 'save' them?

Max Erickson maxerickson at gmail.com
Mon Mar 26 12:11:16 EDT 2007


John Nagle <nagle at animats.com> wrote:

> htags = soup.findAll({'h2':True, 'H2' : True}) # get all H2 tags,
> both cases 

Have you been bitten by this? When I read this, I was operating under 
the assumption that BeautifulSoup wasn't case sensitive, and then I 
tried this:

>>> import BeautifulSoup as BS

>>> soup=BS.BeautifulSoup('<b>one</b><B>two</B>')
>>> soup.findAll('b')
[<b>one</b>, <b>two</b>]
>>> soup.findAll({'b':True})
[<b>one</b>, <b>two</b>]
>>> 

So I am a little curious.


max




More information about the Python-list mailing list