Html: replacing tags
see at my.signature.com
Sun Jun 8 02:09:46 CEST 2003
I'm working on an RSS aggregator and I'd like to replace all img-tags in
a piece of html with links to the image, thereby using the alt-text of
the img as link text (if present). The rest of the html, including tags,
should stay as-is. I'm capable of doing this in what feels like the dumb
way (parsing it with regexes for example, or plain old string splitting
and rejoining), but I have this impression the HTMLParser or htmllib
module should be able to help me with this task.
However, I can't figure out how (if?) I can make a parser do this. Does
the formatter module fit in here somewhere? The docs, the effbot's guide
and the posts regarding html only seem to highlight getting data out of
the html (retrieving links seems particularly popular), not replacing
tags with other ones.
Help in clearing up my confusion regarding this matter would be
Contact info (decode with rot13): cebwrpg5 at bcrenznvy.pbz
Fcnzserr! Cyrnfr qb abg hfr va choyvp zrffntrf. V ernq gur yvfg, ab arrq gb PP.
Posted via http://dbforums.com
More information about the Python-list