title: How to interact with external command line program using Python (on windows)
body: <p>I have a program (let's say program.exe) that can be executed on a command line. After being executed, it asks for some inputs, runs for a while, and gives some outputs. I need to write a python script that interacts with this program so that it can continuously send/receive inputs/outputs.</p>
  <p>I have tried the libraries <a href="https://docs.python.org/3/library/subprocess.html" rel="nofollow noreferrer">subprocess</a> and <a href="https://pexpect.readthedocs.io/en/stable/index.html" rel="nofollow noreferrer">Pexpect</a>, but so far I have not managed to implement this functionality. If anyone knows how to do this I would appreciate a working example so I can adapt it.</p>
  <p>Thank you very much for your help!</p>