这是我正在处理的脚本。它应该为下面的循环运行一个 .exe 文件。(顺便说一句,不确定它是否可见,但 for el in ('90','52.6223',...) 在循环之外并与其余部分进行嵌套循环)我不确定排序是否正确或什么不是。此外,当 .exe 文件运行时,它会吐出一些东西,我需要在屏幕上打印出某一行(因此您会看到 AspecificLinfe= ... )。任何有用的答案都会很棒!
for el in ('90.','52.62263.','26.5651.','10.8123.'):
if el == '90.':
z = ('0.')
elif el == '52.62263.':
z = ('0.', '72.', '144.', '216.', '288.')
elif el == '26.5651':
z = ('324.', '36.', '108.', '180.', '252.')
else el == '10.8123':
z = ('288.', '0.', '72.', '144.', '216.')
for az in z:
comstring = os.path.join('Path where .exe file is')
comstring = os.path.normpath(comstring)
comstring = '"' + comstring + '"'
comstringfull = comstring + ' -el ' + str(el) + ' -n ' + str(z)
print 'The python program is running this command with the shell:'
print comstring + '\n'
process = Popen(comstring,shell=True,stderr=STDOUT,stdout=PIPE)
outputstring = myprocesscommunicate()
print 'The command shell returned the following back to python:'
print outputstring[0]
AspecificLine=linecache.getline(' ??filename?? ', # ??
sys.stderr.write('az', 'el', 'AREA' ) # ??