On May 1, 12:33 am, weheh <[email protected]> wrote:
> From doc:
> table=[['a','b'],['c','d']]
> print TABLE(*[TR(*rows) for rows in table])
>
> I want to change the color of the cells in the table according to
> something like this, but I don't know how to say it. This is the best
> I can come up with. Can someone offer a suggestion how to do this?
>
> colors=[['#FF0000','#00FF00'],['#0000FF','#FFFF00']]
> print TABLE(*[TR(*rows for rows in table,_style="color: %s;" % *color)
> for color in colors])
Since
print TABLE(*[TR(*rows) for rows in table])
can really be
print TABLE(*table)
then you can
print TABLE( [ map(lambda v,c: TD(v,_style='color:%s'%c),*(t[i],c
[i])) for i in range(len(t)) ] )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---