[mod_python] unsupported format character '"' (0x22) at index 30

Robert Brewer fumanchu at amor.org
Wed Dec 15 10:43:15 EST 2004

Lee jundong wrote:
> I find a matter.In case of using "%" symbol to link string,like:print
> str1%str2.It can't work  with Modpython.But it can work ok with pure
> python.How to do it?

The width values in your HTML have % characters. These need to be
escaped when using string formatting:

The quickest way to get yours to work is to simply double every
extraneous % in your content:

def welcome (req):
    content = """
<table border="0" width="100%%">
    <td width="15%%" valign="top">%s<!--Menu-->
    <td width="85%%" valign="top">WELCOME!</td>
    return content % frame.Menu()

Robert Brewer
Amor Ministris
fumanchu at amor.org

More information about the Mod_python mailing list