HTML tables can be created in a cell. For example, paste the following into a cell:
%html <p> <table style="text-align: center; width: 100%;" border="1" cellpadding="2" cellspacing="2> <tbody> <tr> <td> 1 </td><td> 2</td> </tr> <tr> <td> 3 </td><td> 1+2<sup>4</sup></td> </tr> </tbody> </table> However, if you put anything after the "</table>" you'll get nothing. Try pasting this into a cell: %html <table style="text-align: center; width: 100%;" border="1" cellpadding="2" cellspacing="2> <tbody> <tr> <td> 1 </td><td> 2</td> </tr> <tr> <td> 3 </td><td> 4</td> </tr> </tbody> </table> hi = "Hello World!" I get nothing at all. On 3/9/07, Timothy Clemans <[EMAIL PROTECTED]> wrote: > > Hi, > > I created an interesting html table and colored it, using Python. I > tried putting the code into SAGE, but I just could not seem to get it > to work (just a bunch of \n's). > > http://tclemans.nonlogic.org/table.html > > def dt(s): > string = "<html>\n" > string += "<head>\n" > string += "<title>Factor Table</title>\n" > string += "<style>\n" > string += "table {margin: 0; padding: 0; border: 1px solid #ccc;}\n" > string += "tr {margin: 0; padding: 0; border: 1px solid #ccc;}\n" > string += "td {margin: 0; padding: 0; border: 1px solid #ccc; > width: 20px; height; 20px;}\n" > string += "#yes {background: red; margin: 0; padding: 0; width; > 20px; height: 20px;}\n" > string += "#no {background: blue; margin: 0; padding: 0; width; > 20px; height: 20px;}\n" > string += "</style>\n" > string += "<body>\n" > string += "<table>\n" > > for a in range(1,s+1): > string += "<tr>" > for b in range(1,s+1): > if a%b == 0: > string += '<td id="yes"></td>' > else: > string += '<td id="no"></td>' > string += "</tr>\n" > string += "</table>\n</body>\n</html>\n" > return string > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---
