cgi, templates, and the % operator

Moshe Zadka moshez at math.huji.ac.il
Sun Jul 23 01:32:13 EDT 2000


On Sun, 23 Jul 2000, Bob Horvath wrote:

> HI all,
> 
> I have a CGI script that I would like to be able to use the
> % operator and a HTML template to product the outout.
> Unfortunately, the HTML that is the template contains table tags
> that have percentage widths on them , as in '<table align="center"
> width="90%">'.  Later, of course, I have something like 'blah blah
> %(var_to_be_replaced)s blah blah'.
> 
> The problem is that the % in the width setting looks like a format
> string.
> 
> Anyway to escape the %, or to turn it into something else that
> won't screw up the % operator.

Yes -- use %%.

--
Moshe Zadka <moshez at math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.
http://advogato.org/person/moshez





More information about the Python-list mailing list