I have the following code:
-- content of sys.argv is 2 and 10 which is assigned to the specified variables.
wthreshold, cthreshold = sys.argv
def Alerting():
if PatternCount < wthreshold:
print
print LRangeA
print
print 'PatternMatch=(' + str(PatternCount) + '),' + 'ExactTimeFrame[' + str(BeginSearchDVar) + ',' + str(EndinSearchDVar) + ']=(Yes)'
print
sys.exit(0)
elif PatternCount >= wthreshold and PatternCount < cthreshold:
print
print LRangeA
print
print 'PatternMatch=(' + str(PatternCount) + '),' + 'ExactTimeFrame[' + str(BeginSearchDVar) + ',' + str(EndinSearchDVar) + ']=(Yes)'
print
sys.exit(1)
elif PatternCount >= cthreshold:
print
print LRangeA
print
print 'PatternMatch=(' + str(PatternCount) + '),' + 'ExactTimeFrame[' + str(BeginSearchDVar) + ',' + str(EndinSearchDVar) + ']=(Yes)'
print
sys.exit(2)
else:
print
print LRangeA
print
print 'PatternMatch=(' + str(PatternCount) + '),' + 'ExactTimeFrame[' + str(BeginSearchDVar) + ',' + str(EndinSearchDVar) + ']=(Yes)'
print
sys.exit(3)
LRangeA = """this line 1
another line 2
one more line 3
line 4
line 5
line 6
line 7
line 8"""
PatternCount = len(LRangeA.split('\n'))
Alerting()
When I run this code, it doesn't seem to be correctly checking the numbers in the if statements. The code always seems to go into the first if statement even though the value of PatternCount is 8.
Aucun commentaire:
Enregistrer un commentaire