HTML Tables

Adrian Smith adrian_p_smith at yahoo.com
Mon Aug 18 08:05:30 EDT 2008


On Aug 18, 7:16 pm, Amie <sthembileng... at gmail.com> wrote:
> Afternoon all.
>
> Just want to know how to create html tables using a for loop.
> I need to display 34 html tables, so I figured a for loop will do.
> Please show me an example of how to do that.

for i in range(33):
    print "<table border>"
    for j in range(numberofrows-1):
        print "<tr><td>stuff</td><td>stuff</td><td>stuff</td></tr>"
    print "</table>"

Or something like that. You could have for loops for the individual
rows, too.



More information about the Python-list mailing list