Raw Newbie: What's the "<?" tag and how can I learn more about it?

Alan Kennedy alanmk at hotmail.com
Wed Nov 13 12:37:13 EST 2002


KEVIN ZEMBOWER:

>> I've found templates which look like this:
>>     <? if body is None ?>
>>       <hr><strong>["%(type)s" not shown]</strong>
>>     <? else ?>
>>       <hr><table width="640">
>>       <tr><td>%(markup_urls(html(body)))s</td></tr>
>>       </table>
>>     <? end ?>
>>
>> Obviously, this is python code embedded in HTML, very similar to php in
>> HTML, with which I am more familiar. However, I can't find any
>> references to the "<?" tag system on the python.org web site.

As Simon mentioned already, that's because it's not part of core python,
it belongs to whatever template system ezmlm uses.

>> The specific problem I'm working on involves the line '<hr><table
>> width="640">'. I'd like to change the width to "100%", but the percent
>> sign must be interpreted as a special character. It causes strange
>> errors. I've tried escaping it with 'width="100\%"', but this doesn't
>> seem to work, either. Any help on this small problem?

I don't know for certain, but the "100%" may be being interpreted as a
python "format string". See these urls for information on format
strings.

http://www.python.org/doc/current/tut/node9.html
http://sandbox.mc.edu/~bennet/python/code/io.html

IFF it is a format string, then the solution is to double up the % sign:
i.e. express it like so "<table width='100%%'>".

However, if that isn't the problem, I don't have any further suggestions
to make.

regards,

-- 
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan:              http://xhaus.com/mailto/alan



More information about the Python-list mailing list