|
|
||||||
|
#1
|
|
|
|
|
I know you could use the
def start_a ..... def end_a ..... to process the <a href=...> anchor </a> tags, but is there a default method for processing ALL tags? If I just want change some parts of the hyperlink and want to keep other parts of the HTML could I just print them out? There should be such a method. Can't find it... Thank you. |
|
|
|
#2
|
|
|
|
|
Hubert Hung-Hsien Chang <hubert> wrote:
> I know you could use the >> def start_a > .... > > def end_a > .... > > to process the <a href=...> anchor </a> tags, but is there a > default method for processing ALL tags? If I just want change > some parts of the hyperlink and want to keep other parts of the HTML > could I just print them out? There should be such a method. > Can't find it... You could subclass HTMLParser.HTMLParser and override handle_starttag and handle_endtag (also, if needed, handle_charref, handle_entityref, and last but not least handle_data -- that's assuming that while you only talk about processing _tags_ you may in fact also want to process references and text nodes... possibly handle_comment, too, btw). Alex |
|
#3
|
|
|
|
|
hubert (Hubert Hung-Hsien Chang) wrote in message news:9ee9
> I know you could use the >> def start_a > .... > > def end_a > .... > > to process the <a href=...> anchor </a> tags, but is there a > default method for processing ALL tags? If I just want change > some parts of the hyperlink and want to keep other parts of the HTML > could I just print them out? There should be such a method. > Can't find it... > > Thank you. If you are modifying the contents of tags I've written a simple HTML parser class called Scraper that does this. Unlike the HTMLParser in the standard library it doesn't choke so much on badly formed HTML.... It's part of approx.py my cgiproxy.... [url down] HTH Regards, Fuzzy |
|
|
| Similar Threads | |
| Linux inotify - how can I get process id of processing doing action? Hi I'm currently learning to use the Linux inotify subsystem API which allows a program to be notified of file system changes/accesses etc. However , while it'll tell you... |
|
| question on processing HTML with a regex Hi, I would like to process an HTML file in the form <tr> row1 </tr> <tr> row2 </tr> |
|
| processing html tags in my cdata (urgent please) HI all i am new with this, I have a cdata that includes <br> html tags and i need to process this when it goes live , i am using an xslt file to do that i cant change the... |
|
| Analysis Services Processing Task Not Processing Cubes Correctly I have a DTS package that is set up to process the dimensions contained in my cubes. They are set to rebuild the dimension structures (and process). I have another DTS... |
|
| Problem downloading and installing a .CAB (ERR: INF Processing: Failed (800c0300) processing: msvcrt.dll.) I have created a VB 6 application that uses ActiveX and DCOM in a three tier Intranet application. I can download version 1 to a Win 2000 worksation successfully. When I... |
|
|
All times are GMT. The time now is 03:32 AM. | Privacy Policy
|