How to append a tag after a link with BeaufitulSoup

Posted by systempuntoout on Stack Overflow See other posts from Stack Overflow or by systempuntoout
Published on 2010-05-25T20:39:45Z Indexed on 2010/05/25 20:41 UTC
Read the original article Hit count: 139

Filed under:
|

Starting from an Html input like this:

<p>
<a href="http://www.foo.com">this if foo</a>
<a href="http://www.bar.com">this if bar</a>
</p>

using BeautifulSoup, i would like to change this Html in:

<p>
<a href="http://www.foo.com">this if foo</a><b>OK</b>
<a href="http://www.bar.com">this if bar</a><b>OK</b>
</p>

Is it possible to do this using BeautifulSoup?

© Stack Overflow or respective owner

Related posts about python

Related posts about beautifulsoup