2 回答

TA貢獻1874條經(jīng)驗 獲得超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)]))
添加回答
舉報