I have a problem with my if statements. It involves looking for a pair of strings and collecting the times and then subtracting them, but I don't get why it doesn't work, and with a small loop inside to count the difference and if it's less it prints it out:
fh = open('Perfe.txt')
R=0
Z=0
for line in fh:
line=line.rstrip()
if not 'Service Permission' in line :
continue
Y=line.split()
Time1=float(Y[1])
elif not 'Assignment Finished' in line :
continue
U=line2.split()
Time2=float(U[1])
R=R+1
if (Time2-Time1) <= 3:
print 'time of Request setup end',Time2-Time1
else:
continue
print R
and the Data is
Time
A1 139.637737000 Service Permission
Time
B1 141.167620000 Assignment Finished
Time
A1 159.897737000 Service Permission
Aucun commentaire:
Enregistrer un commentaire