Formatting a column's value output
Chris Angelico
rosuav at gmail.com
Sat Jan 26 13:04:12 EST 2013
On Sun, Jan 27, 2013 at 4:51 AM, Ferrous Cranus <nikos.gr33k at gmail.com> wrote:
> print ( "<td><b><font color=yellow> %s </td>" % item )
>
> In the aboce code wheb 'URL' is to be typed out be print i need it to be formatted as a link, so the viewer can click on it.
>
> Is this possible please?
Easy, just make a tuple of item,item and have two %s markers:
print( "<td><b><font color=yellow><a href='%s'>%s</a></td>" % (item, item) )
But you need to concern yourself with escaping. In fact, you already
needed to, just to produce it as text - but it's now even more
important. I strongly suggest you look into that.
ChrisA
More information about the Python-list
mailing list