2 回答
TA贡献1874条经验 获得超12个赞
首先做以下修改logdetail():
def logdetail(FILE):
collect = False
array = []
current = []
with open(FILE, 'r+') as f:
for line in f:
if line.startswith('LOG:'):
collect = True
else:
if line.startswith('RESULT: '):
collect = False
array.append(current)
current=[]
if collect:
current.append(line.strip())
return(array)
然后用它来打印(假设总是len(testname) = len(logdetails))
testname = testname(TEST)
loddetails = logdetail1(TEST)
for test in testname:
print (test + '\t' + " ".join(logdetail1[testname.index(test)]))
添加回答
举报