store tag content with SGMLParser ... ?

Lukas Holcik xholcik1 at fi.muni.cz
Fri Mar 26 08:45:59 EST 2004


	Hi Python people!

I'd like to ask you a question about parsing html with SGMLParser class 
from module sgmllib. Is there a way I could get contents of a tag with 
certain properties? For example: I'd like to get a list of all contents 
and hrefs of <a> tags, which have certain value of "class" property:

	<a class="section" href="http://example.com">BLABLABLA</a>

I'd like to get stored the "http://example.com" and the "BLABLABLA", 
while class="section". Probably with the use of SGMLParser method 
handle_data. Or better use different approach? Thanks for answers!:)

	#Luk



More information about the Python-list mailing list