Python execute command line,sending input and reading output
io, python
Solution
You probably want `subprocess.Popen`. To communicate with the process, you'd use the `communicate` method.
e.g.
process=subprocess.Popen(['command','--option','foo'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
inputdata="This is the string I will send to the process"
stdoutdata,stderrdata=process.communicate(input=inputdata)
Problem
How to achieve the following functionality: - Python executes a shell command, which waits for the user to `input` something - after the user typed the `input`, the program responses with some `output` - Python captures the `output`