#Okay first if you want the table to have HEADERS above each column you should save the heading names in a list like so...
listofheaders=['header1','header2','header3']
#for each row in the table save the data included in the row in a list of lists something like this:
listofrows=[['a','b','c'],['a','b','c'],['a','b','c']]
#now create a string with the following:
htmlstuff='\n\n
\n\n\n\n\n#now you would add the COLUMN HEADERS to the list...
for header in listofheaders:
htmlstuff=htmlstuff+'
'+str(header)+'\n'#then you can populate the table row by row...
for row in listofrows:
htmlstuff+='
\n'for item in row:
htmlstuff=htmlstuff+'
'+str(item)+'\n'htmlstuff+='
\n'#finish off the html coding...
htmlstuff+='
\n\n\n'#now create the html page and write the data...
f=open('webpage.html','w')
f.write(htmlstuff)
f.close()
你甚至可以使用webbrowser自动打开页面。在
^{pr2}$