0

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>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Andrew
  • 3
  • 1

1 Answers1

0
for k in s[i:i+60]:
    req.write('<td>%s</td>' % k)
req.write('</tr>')
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358