I am running an external program using pipes in python and it works fine. However I would like to pass two arguments to this external program.
Could anyone help me with that?
Thanks!
from subprocess import Popen, PIPE
p = Popen(['external-program', 'arg1', 'arg2'],
stdin=PIPE, stdout=PIPE, stderr=PIPE)
if you mean piping the out into or out of the Python script, or
from subprocess import Popen, PIPE
p = Popen('external-program arg1 arg2 | external2'], shell=True)
if you mean piping output between external programs.
See the subprocess docs . Post your code if you want a different type of solution.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.