for a in ('90','52.6', '26.5'):
if a == '90':
z = (' 0',)
elif a == '52.6':
z = ('0', '5')
else:
z = ('25')
for b in z:
cmd = exepath + ' -a ' + str(a) + ' -b ' + str(b)
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') != -1:
print i
Run Code Online (Sandbox Code Playgroud)
处理作业,这是我的代码片段.这个代码上方有一部分,但它所做的只是定义exepath并只是在屏幕上打印exepath.当我运行它时,我没有得到任何错误或任何东西,但程序刚进入命令提示符时结束.为什么?以及如何解决?
编辑:抱歉报价但问题.我更新了代码以解决这个问题,但它仍然没有给我任何回复它只是退出...问题是什么?