更改htm背景色的Python代码

2024-05-19 10:24:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我用python创建了一个仪表板。我需要对html页面进行一些修饰性的更改。在

  1. 更改字体和大小
  2. 更改背景色
  3. 放一个公司标志。在

我研究了turtle和{},并安装了相同的,但系统没有重新编码模块。有没有办法实现上述功能。 源代码如下

#!/usr/local/bin/python
import requests
import json
import datetime
import sys
import os
from html import HTML
todayDate=datetime.date.today().strftime("%Y-%m-%d")
h=HTML('html','')
p=h.p('DETAILS for ',' ', todayDate)
t=h.table(border='1')
r=t.tr()
r.td('Import Timestamp')
r.td('JobId')
r.td('Status')
r.td('RecordsProcessed')
r.td('RecordsFailed')
r.td('FileName')
r.td('Duration')
r.td('Throughput')
print '\n'
def genHTMLforImportSuccess():
                responseurl = requests.get(url)
                if(responseurl.ok):
                        jData = json.loads(responseurl.content)
                        if jData > 0:
                                for responseurl in jData['response']:
                                        starttime=responseurl['statistics']['startTime']
                                        jobId= responseurl['jobId']
                                        status = responseurl['status']
                                        recordsProcessed=responseurl['statistics']['recordsProcessed']
                                        recordsFailed=responseurl['statistics']['recordsFailed']
                                        fileName=responseurl['fileName']
                    duration=responseurl['statistics']['duration']
                    throughput=responseurl['statistics']['throughput']
                                        print '\n'
                                        r=t.tr()
                                        r.td(str(starttime))
                                        r.td(str(jobId))
                                        r.td(str(status))
                                        r.td(str(recordsProcessed))
                                        r.td(str(recordsFailed))
                                        r.td(str(fileName))
                    r.td(str(duration))
                    r.td(str(throughput))
                                        print '\n'
                        else:
                                print "No data feed"
                else:
                        responseurl.raise_for_status()
genHTMLforImportSuccess()
print h

非常感谢任何帮助

我在 从html导入html

^{pr2}$

却得不到想要的结果如何我能修好这个吗


Tags: importforhtmlstatusfilenametddurationprint

热门问题