exepath = os.path.join(file location here)
exepath = '"' + os.path.normpath(exepath) + '"'
results = []
for e in ('90','52.62263','26.5651','10.8123'):
if e == '90':
z = ('0',)
elif e == '52.62263':
z = ('0', '72', '144', '216', '288')
elif e == '26.5651':
z = (' 324', ' 36', ' 108', ' 180', ' 252')
else:
z = (' 288', ' 0', ' 72', ' 144', ' 216')
for a in z:
cmd = exepath + ' -e ' + str(e) + ' -a ' + str(a) + ' ' + sys.argv[1] + ' ' + sys.argv[2]
print cmd
process = Popen(cmd, shell=True, stderr=STDOUT, stdout=PIPE)
outputstring = process.communicate()[0]
outputlist = outputstring.splitlines()
for i in outputlist:
if i.find('The student says the area is:') != -1:
print i
results.append(i)
print i
for s in results:
print s
This is part of my code right now. It works perfectly fine. It scans the output of the exe file when fed through the numbers i give it in the for loop and spits out the line's that say The student says the area is 16 times for the group (90,0),(52.62263,0),...... etc. The only thing I want to fix is when it prints out the lines "The student says the area is", I want it just to print out for example (90,0) or whatever for whichever line it pertains to so it can be easily read. Any code would be helpful. I'm thinking about copying and pasting the for loop with the numbers and somehow calling it but not sure how. Thanks ahead of time. And of course i've imported everything correctly.
Right now it prints:
The Student says the area is: (" The Calculated number" ) ...x16 times
I just want the first line for example to print out:
The Student says the area is: (" The Calculated number" ) 90,0
doesn't have to be neat just the number printed out the side
the next one should be
The Student says the area is: (" The Calculated number") 52.62263,0
...x16