HTML Tables

Stefan Behnel stefan_ml at behnel.de
Tue Aug 19 14:32:13 EDT 2008


Amie wrote:
> Thanks for your help so far. Ok here's a scenario: I have to create a
> site that displays 34 html  tables.
> In each of these tables the following information has to be displayed:
> logo (image), site name, date, time.
> Remember: in all of these 34 tables. the information displayed on each
> of these tables is retrieved from the database. I did write a mysql
> query, I just don't know how to link it with the for loop that has to
> display all these tables. If anyone can, can you roughly show me how
> to go about doing this.

This might get you going:

http://codespeak.net/lxml/lxmlhtml.html#creating-html-with-the-e-factory

Try something like this:

    tables = []
    for row in rows_returned_by_the_query:
        tables.append(
             E.TABLE( ... )
        )

    html_body = E.BODY( *tables )

Stefan



More information about the Python-list mailing list