3 回答

TA贡献1909条经验 获得超7个赞
我认为很明显,有很多方法可以做到这一点,下面是我到达的代码-可能不是最整洁的代码,但是我发现它相当透明且易于操作。
x= open('file')
logs=x.readlines()
iLine = logs[6]
log_enumerater = enumerate(logs)
for iLine in log_enumerater:
if iLine[1].find('CATCH') != -1:
Event=iLine[1].split('\t')[3]
word=Event.split('_')[1]
t0=int(iLine[1].split('\t')[4])
print iLine[1].split('\t')[3].split('_')[1], iLine[0]
print 'Catch in line ', iLine[0]
myLine = int(iLine[0])+2
print 'Response in Line', myLine
if iLine[1].find('Response') != -1:
t1= int(iLine[1].split('\t')[4])
ResponseTime= t1-t0
print ResponseTime
我一直在使用它来获取试用编号,现在已经对其进行了一些调整,以获取响应时间。
添加回答
举报