Html: replacing tags
Grzegorz Adam Hankiewicz
gradha at titanium.sabren.com
Mon Jun 16 17:07:40 EDT 2003
On 2003-06-13, Lee Harr <missive at frontiernet.net> wrote:
> I needed to do something very similar recently. I was making
> a mirror of a website for burning on to a cdrom, so all links
> needed to be made relative instead of absolute.
>
> It seems like this may be a very common thing to do (replacing
> tags). If someone makes a general solution, it might be nice if
> this functionality were in the standard library.
>
> My solution was to get a list of the tags and then just
> line.replace(old_tag, new_tag) through the file.
>
> Problem is it tends to find things that should not be replaced.
I wrote that not long ago for work and packaged it inside a small
class which allows link extraction and link modification. You can
get it from http://gradha.sdf-eu.org/efaber.en.html.
--
Please don't send me private copies of your public answers. Thanks.
More information about the Python-list
mailing list