Add links to a text (take II)

10 November 2004   2 comments   Python

Mind that age!

This blog post is 17 years old! Most likely, its content is outdated. Especially if it's technical.

If you missed the entry about Add links to text with URLs I suggest you read that first. This script has now been improved with bug fixes thanks to David Otton and Flump Cakes.

Download: addhrefs-0.4.tgz
It does not come with a nice installer because I don't think it belongs to the generic Python library anyway. If you want to use it, copy the file to somewhere useful.

This is how it works:

>>> from addhrefs import addhrefs
>>> t='''Hello
and go to
send to 
or <>'''
>>> print addhrefs(t)
Hello <a href=""></a>
and go to <a  href=""></a>
send to <a href=""></a> 
or <<a  href=""></a>>

The example might be confusing since the Python code highlighter tries to do what addhrefs does.

UPDATE: Link to addhrefs-0.4.tgz didn't work before. Now it does.


Bob Marley

Hello? people! visit to my site!


I don't know how I found this, but it's strange. Thanks

Your email will never ever be published

Related posts