Код: Выделить всё
#math_app.py
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-a", "--add", type=str, help="Add integers together")
parser.add_argument("-s", "--subtract", type=str, help="Subtract integers")
args = parser.parse_args()
if args.add:
add_list = args.add.split(',')
#add code here
elif args.subtract:
sub_list = args.subtract.split(',')
#subtract code here
Код: Выделить всё
from subprocess import Popen, PIPE
p= Popen("math_app.exe --add=1,2,3 --subtract=10,5",stdin=PIPE,stdout=PIPE,stderr=PIPE, encoding="UTF8")
command='START\n'
p.stdin.write(command)
p.stdin.flush()
response=p.stdout.read()
print(response)
Спасибо ты!
Подробнее здесь: https://stackoverflow.com/questions/741 ... rom-python