473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 1325
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Elger | last post by:
Dear Members, A newbie question How do I convert this XML example into HTML (using XSLT)? <DOCUMENT> <PARA> This <BOLD>is</BOLD> a <BOLD>test</BOLD> </PARA> </DOCUMENT>
4
by: DragonLord | last post by:
I have a custom user control that i am trying to understand and it has numbers before the line items. So here it comes the real newbie question What the heck are the numbers for?? 205: For...
5
by: kamikaze04 | last post by:
Hello. I have a very newbie question about Streams. The situation is that i have a function (that i cannot modify it's definition/call): public void F1(istream & in){ while( ...) { ...
5
by: Banibrata Dutta | last post by:
Hi, I've gone through the list of "language differences" between 2.3 / 2.4 & 2.5 of CPython. I've spend around 2 weeks now, learning v2.5 of CPython, and I consider myself still very very...
16
by: Raxit | last post by:
Hi, i was reading/learning some hello world program in python. I think its very simillar to Java/C++/C#. What's different (except syntax) ? what can i do easily with python which is not easy...
7
by: idiolect | last post by:
Hi all - Sorry to plague you with another newbie question from a lurker. Hopefully, this will be simple. I have a list full of RGB pixel values read from an image. I want to test each RGB band...
5
by: Randall | last post by:
I am a newbie trying to learn the DOM. Can someone tell me why the first alert statement returns null, and the second returns the value 33px (which was set using the style="top:33px;" in the DIV...
12
by: Philipp.Weissenbacher | last post by:
Hi all! This is most certainly a total newbie question, but why doesn't the following code cause a segfault? void insertion_sort(int a, int length) { int i; for (i=0; i < length; i++) { int...
3
Lokean
by: Lokean | last post by:
Sorry for this newbie question, this is not my realm of expertese. I have searched google, tried several applications that claim they can do this, such as Mapforce, which I found confusing, to...
5
by: Dave | last post by:
I am new to Visual Web Developer 2005 Expres. I am using absolute positioning and every time I add a button control to my web form its width extends all the way to the edge of the page. IOW I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.