2

我在用:

rows = db(db.member.membership_id==request.args[0]).select(db.member.membership_id,
    db.member.first_name,
    db.member.middle_name,
    db.member.last_name,
    db.member.birthdate,
    db.member.registration_date,
    db.member.membership_end_date)

rows.colnames = ('Membership Id', 'First Name', 'Middle Name', 'Last Name', 
    'Birthday Date', 'Registration Date', 'Membership ending Date')
table = SQLTABLE(rows, _width="100%")

现在我想转置表格,我该怎么做?

4

1 回答 1

1

尝试这个:

rows=db(query).select(*fields).as_list()
if rows:
   table=TABLE(*[TR(TH(field),*[TD(row[field]) for row in rows]) \ 
       for field in row[0].keys()])
else:
   table="nothing to see here"
return dict(table=table)
于 2009-10-11T15:59:28.607 回答