How do I format this

Sunit Joshi sjoshi at ingr.com
Fri Apr 26 17:12:16 EDT 2002


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>
"""

The dictionary is 
{'isdir': 0, 'indent': 1, 'name': 'TonyFile.txt', 'isroot': 0,
'fullname': 'E:\\temp\\tony\\TonyFile.txt', 'modified': 'Fri Apr 19
09:02:17 2002', 'sizefm': ' Bytes', 'size': 20.0}

However it fails at <td width="1\%"> eventhough I'm escaping the '%'
with a message ValueError: unsupported format character '"' (0x22) at
index 17

Any ideas what I'm doing wrong here.

thanks
Sunit
sunitjoshi at netzero.net



More information about the Python-list mailing list