How do I format this
Trent Mick
trentm at ActiveState.com
Fri Apr 26 17:26:32 EDT 2002
[Sunit Joshi wrote]
> Hello
> I have a format string which I'm formatting using a dict. The format
> string is
> """
> <td width="1\%">
> <input type=radio value="%(fullname)s****%(isdir)s" name=radioName>
> <IMG height=17 hspace=2 src="ezmedia/window/filephotoicon.jpg"
> width=19>
> </td>
> <td>
> <div class="menucontents"><a href="%(fullname)s">%(name)s</a></div>
> </td>
> <td width="10\%">
> <div class="menucontents">%(ext)s</div>
> </td>
> <td width="15\%">
> <div class="menucontents">%(size)s</div>
> </td>
> <td width="22\%">
> <div class="menucontents">%(modified)</div>
> </td>
> </tr>
> """
1. You want to use %% to escape a percent sign, rather than /%.
2. You missed at least one trailing 's' on a '%(foo)s' block
Try this:
"""
<td width="1%%">
<input type=radio value="%(fullname)s****%(isdir)s" name=radioName>
<IMG height=17 hspace=2 src="ezmedia/window/filephotoicon.jpg"
width=19>
</td>
<td>
<div class="menucontents"><a href="%(fullname)s">%(name)s</a></div>
</td>
<td width="10%%">
<div class="menucontents">%(ext)s</div>
</td>
<td width="15%%">
<div class="menucontents">%(size)s</div>
</td>
<td width="22%%">
<div class="menucontents">%(modified)s</div>
</td>
</tr>
"""
Cheers,
Trent
--
Trent Mick
TrentM at ActiveState.com
More information about the Python-list
mailing list