开发者

Python: PSP & HTML tables

I have a python psp page code is shown below. Currently it only prints out the characters in single rows of 60, with the character count in the left column.

<table>
<%
s = ''.join(aa[i] for i in table if i in aa)
for i in range(0, len(s), 60):
    req.write('<tr><td><TT>%04d</td><td><TT>%s</TT></td></tr>' % (i+1, s[i:i+60]));
#end
%>
</table>

The problem i am having trouble is with out putting each character in an individual cell rather than a cell of 60 characters. I've tried doing this with the code below, but it prints out a line of 60 characters 60 times.

<table>
<%
s = ''.join(aa[i] for i in table if i in aa)
for i in range(0, len(s), 60):
    req.write('<tr><td>%04d</td>' % (i+1));
    for k in s:
        req.write('<td>%s</td></tr>' % s[i开发者_运维技巧:i+60]);
#end
%>
</table>


for k in s[i:i+60]:
    req.write('<td>%s</td>' % k)
req.write('</tr>')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜