newbie question

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Apr 25 22:02:05 EDT 2008


En Fri, 25 Apr 2008 19:35:58 -0300, John <mysakjs at gmail.com> escribió:

> I'm working with the HTMLParser module and have implemented
> HTMLParser.handle_starttag() and I see there is a separate
> handle_data
> method (which can be implemented), but I am not clear how to tie this
> together with a given start tag, so I only get the data I want.
>
> For example, I'd like to get a handle on the character data ( the
> number 1) immediately after the following start tag
>
>
> <span class="calPast">
> 1</br>
> .
> .
> .
> Any ideas?

I usually don't recommend HTMLParser because a lot of HTML documents in  
the Web are not even remotely valid, and the parser can't handle that.
BeautifulSoup is a more robust alternative:  
<http://www.crummy.com/software/BeautifulSoup/>


-- 
Gabriel Genellina




More information about the Python-list mailing list