これは、私が取り組んでいるスクリプト用です。以下のループでは、.exe ファイルを実行することになっています。(ちなみに、表示されているかどうかはわかりませんが、 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' ) # ??