简体   繁体   中英

coloring a table row in python using HTML.py module

htmlcode=HTML.table(table_data,header_row=['Check','Setup','status','Logs','Comment'],
            col_width=['30%','20%','20%','10%','30%'])

here i want to color the table header row with grey color. as a beginner in this language i couldnt figure it out. here im using a HTML.py module

i got this module from http://www.decalage.info/en/python/html so pls help in coloring the header row.

You may specify a background color for the header row, by using a TableRow object instead of a list. For example:

t = HTML.Table(header_row = HTML.TableRow(['x', 'square(x)', 'cube(x)'], bgcolor='yellow'))


Source : one of the comments on module page : http://www.decalage.info/en/python/html

It doesn't look like you can change them via anything simple (only allows for per-cell additions w/ color change). I would suggest linking in a css file with some .th{background-color:orange;} stylings, or use another module that is more robust.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM