我试图在这个“for”循环中生成表格。我被困在我需要做的事情以允许表名中的字符串成为表的名称。
tablenames = ['t_10', 't_20', 't_30', 't_40', 't_50', 't_60', 't_70', 't_80', 't_90', 't_100']
firstrow = ['10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%']
for t, r, in zip(tablenames, firstrow):
t = [[r, '']]
这就是我最终做的事情 - 我知道,它并不漂亮(我知道有一种方法可以生成我想要的空间数量......它只是不合作......而且, cond1 和 cond0 列表很奇怪...... .)
t_10 = [['10%', '', '', '', '', '', '', '', '', '','','','']]
t_20 = [['20%', '', '', '', '', '', '', '', '', '','','','']]
t_30 = [['30%', '', '', '', '', '', '', '', '', '','','','']]
t_40 = [['40%', '', '', '', '', '', '', '', '', '','','','']]
t_50 = [['50%', '', '', '', '', '', '', '', '', '','','','']]
t_60 = [['60%', '', '', '', '', '', '', '', '', '','','','']]
t_70 = [['70%', '', '', '', '', '', '', '', '', '','','','']]
t_80 = [['80%', '', '', '', '', '', '', '', '', '','','','']]
t_90 = [['90%', '', '', '', '', '', '', '', '', '','','','']]
t_100 = [['100%', '', '', '', '', '', '', '', '', '','','','']]
tnames = [t_10, t_20, t_30, t_40, t_50, t_60, t_70, t_80, t_90, t_100]
cond1 = [conditions_list[0], conditions_list[2], conditions_list[4], conditions_list[6], conditions_list[8]]
cond0 = [conditions_list[1], conditions_list[3], conditions_list[5], conditions_list[7], conditions_list[9]]
for t, c1, c0 in zip(tnames,cond1,cond0):
c1_results = process_exhaust(c1,1)
c0_results = process_exhaust(c0, 0)
t.append(c1_results[0])
t.append(c1_results[1])
t.append(c1_results[2])
t.append(c0_results[0])
t.append(c1_results[3])
t.append(c0_results[1])