python - 在python中格式化HTML字体和颜色
问题描述
我编写了一个函数,它在 Confluence 中创建一个网页,列出我们账户中的所有 AWS Ec2 实例。这看起来不错的样子。
除了背景全是灰色的,字体到处都是粗体。
这是我的功能:
def convert_csv_to_html_table(output_file, today):
output_dir = "../output_files/aws_instance_list/html/"
htmlfile = output_dir + 'aws-master-list-' + today +'.html'
count = 0
html = ''
with open(output_file,'r') as CSVFILE:
reader = csv.reader(CSVFILE)
html += "<table><tbody>"
for row in reader:
html += "<tr>"
# Process the headers
if count == 0:
for column in row:
html += "<th>%s</th>" % column
html += "</tr>"
else:
# Process the data
for column in row:
html += "<td>%s</td>" % column
html += "</tr>"
count += 1
html += "</tbody></table>"
with open(htmlfile,'w+') as HTMLFILE:
HTMLFILE.write(html)
return htmlfile
我怎样才能得到只有标题有灰色背景的结果?页面的其余部分有白色背景?另外如何在上面的代码中指定字体和字体大小?
解决方案
推荐阅读
- c# - 按搜索字符串过滤 CollectionViewSource - 绑定到 itemscontrol (WPF MVVM)
- json - 使用 subscribe 或 promise 调用 JSON
- json - 如何将数据帧作为 json 数组写入文件?(斯卡拉)
- c# - 是否有等效于 async 关键字的方法?
- javascript - Vue组件未在laravel中显示
- azure - 从 azure api 策略调用 telemetryclient
- android - Firebase 实时数据库自动增加值
- java - 不使用命名参数时重用 sql 参数
- javascript - 仅从 DOM 中检索一个值,其中包含通过 JS 列出的 100 个数据
- javascript - 在等待完成之前返回的异步函数