471,092 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,092 software developers and data experts.

newbie question

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?
Jun 27 '08 #1
2 1233
En Fri, 25 Apr 2008 19:35:58 -0300, John <my*****@gmail.comescribió:
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

Jun 27 '08 #2
Thanks for the tip!
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Elger | last post: by
16 posts views Thread by Raxit | last post: by
5 posts views Thread by Randall | last post: by
12 posts views Thread by Philipp.Weissenbacher | last post: by
5 posts views Thread by Dave | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.