开发者

Python: PSP & HTML tables

开发者 https://www.devze.com 2022-12-22 10:50 出处:网络
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.

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

精彩评论

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