python run .exe app with argument

后端 未结 1 1042
花落未央
花落未央 2021-01-26 23:47

If i write this in command prompt: \"senna-win32.exe < input.txt >output.txt\" it works perfect but i need to do this from python code, how is this possible?

I hav

1条回答
  •  孤街浪徒
    2021-01-27 00:12

    Thank you Jack!!!

    import subprocess
    myinput = open('in.txt')
    myoutput = open('out.txt', 'w')
    p = subprocess.Popen('senna-win32.exe', stdin=myinput, stdout=myoutput)
    p.wait()
    myoutput.flush()
    

    0 讨论(0)
提交回复
热议问题