There is a program written and compiled in C, with typical data input from a Unix shell; on the other hand, I'm using Windows.
I need to send input to this program from the output of my own code written in Python.
What is the best way to go about doing this? I've read about pexpect
, but not sure really how to implement it; can anyone explain the best way to go about this?
i recommend you use the python
subprocess
module.it is the replacement of the
os.popen()
function call, and it allows to execute a program while interacting with its standard input/output/error streams through pipes.example use: