Python 在一页中显示单独的表格
我对HTML非常陌生,我在这方面使用Python 我有几个单独的HTML“对象”,我想一个接一个地显示,我需要在它们之间留出一个空间 这是我在网上看到的一个例子: 在这里,我们可以看到3个不同的HTML“对象”,我们可以看到它们之间的空间 如何在一页上显示它们 我的代码:Python 在一页中显示单独的表格,python,html,html-table,space,spacing,Python,Html,Html Table,Space,Spacing,我对HTML非常陌生,我在这方面使用Python 我有几个单独的HTML“对象”,我想一个接一个地显示,我需要在它们之间留出一个空间 这是我在网上看到的一个例子: 在这里,我们可以看到3个不同的HTML“对象”,我们可以看到它们之间的空间 如何在一页上显示它们 我的代码: def nlist_to_html(kpi_data_dict): headers_lists = ['Total Revenue'] htable = '<br> <table bor
def nlist_to_html(kpi_data_dict):
headers_lists = ['Total Revenue']
htable = '<br> <table bordercolor=000000 cellspacing="0" cellpadding="1" ' \
'style="table-layout:fixed; background: #F5F5F5; vertical-align:bottom; font-size:15px;font-family:verdana,sans,sans-serif;border-collapse:collapse;border:3px solid rgb(12, 73, 173); color:rgb(20, 99, 226)" >'
for header in headers_lists:
new_header = '<header> <h1> <th bgcolor = "#777" colspan = "6" align = "left" valign = "center"> <font size = "6" color ="white"> {header} </font> </th> </h1> </header>'.format(header= header)
htable += new_header
for row in kpi_data_dict:
newrow = u'<tr>'
newrow += u'<td align="left" style="padding:1px 4px">' + unicode(row[1][1]) + u'</td>'
newrow = newrow + ''.join([u'<td align="center" style="padding:1px 4px">' + unicode(x) + u'</td>' for x in row])
newrow += '</tr>'
htable += newrow
htable += '</table>'
return htable
def nlist_to_html(kpi_data_dict):
标题列表=[“总收入”]
htable='
'
对于标题列表中的标题:
new_header='{header}'。格式(header=header)
htable+=新的_头
对于kpi_数据_dict中的行:
纽罗=u“
新行+=u'+unicode(行[1][1])+u'
newrow=newrow+''.join([u''+unicode(x)+u''表示行中的x])
newrow+=“”
htable+=newrow
htable+=“”
回程表
我不确定,您在这个后端脚本中使用什么语言,但请尝试以下方法:
def nlist_to_html(kpi_data_dict):
headers_lists = ['Total Revenue']
htable = '<br> <table bordercolor=000000 cellspacing="0" cellpadding="1" ' \
'style="table-layout:fixed; background: #F5F5F5; vertical-align:bottom; font-size:15px;font-family:verdana,sans,sans-serif;border-collapse:collapse;border:3px solid rgb(12, 73, 173); color:rgb(20, 99, 226)" >'
for header in headers_lists:
new_header = '<tr> <th bgcolor = "#777" colspan = "6" align = "left" valign = "center" style="margin-top:15px;"> <header> <h1> <font size = "6" color ="white"> {header} </font> </h1> </header> </th> </tr>'.format(header= header)
htable += new_header
for row in kpi_data_dict:
newrow = u'<tr>'
newrow += u'<td align="left" style="padding:1px 4px; margin-top:15px;">' + unicode(row[1][1]) + u'</td>'
newrow = newrow + ''.join([u'<td align="center" style="padding:1px 4px; margin-top:15px;">' + unicode(x) + u'</td>' for x in row])
newrow += '</tr>'
htable += newrow
htable += '</table>'
return htable
def nlist_to_html(kpi_data_dict):
标题列表=[“总收入”]
htable='
'
对于标题列表中的标题:
new_header='{header}'。格式(header=header)
htable+=新的_头
对于kpi_数据_dict中的行:
纽罗=u“
新行+=u'+unicode(行[1][1])+u'
newrow=newrow+''.join([u''+unicode(x)+u''表示行中的x])
newrow+=“”
htable+=newrow
htable+=“”
回程表
我们需要查看您的代码。看起来它们之间已经有空间了。那么问题出在哪里呢?你应该澄清你想做什么,并展示你的代码。请解释你的答案。这是你第一个问题的答案。这不是我的问题。如果没有上下文,您的答案是神秘的。作者想要在抽象的“HTML对象”之间留出空间,但没有向问题添加任何代码。所以我用这个css代码写了一个抽象的答案。