[Tutor] disregard last fortune cookie
Eugene Leitl
Eugene.Leitl@lrz.uni-muenchen.de
Wed, 30 May 2001 14:44:21 +0200 (MET DST)
Indentation got me. Misindented a return, that's wy.
This one works:
def dumptable(table):
result1 = ""
result2 = ""
htmlheader = "<html><head></head><body>"
htmlfooter = "</body></html>"
tablefoot = "</table>"
def tablehead(columns):
return "<table BORDER COLS=" + str(columns) + """ WIDTH="100%" NOSAVE>"""
def tablerow(row):
result1 = "<tr>"
for j in row:
result1 += "<td>"+str(j)+"</td>"
return result1 + "</tr>"
result2 = htmlheader + tablehead(5)
for i in table:
result2 += tablerow(i)
return result2 + tablefoot + htmlfooter
# test table
tt = [[ "oans", "zwoa", 3, 4, 5],
[ 6, "siebene", 8, 9, 10],
["eifi", 12, 13, 14, 15],
[16, 17, 18, 19, 20]]
print dumptable(tt)