Reputation: 1
I execute a program in Linux shell. After that, the program starts as a console application and waits for keyboard inputs. Is it possible to give these inputs to the program using a python script?application
Upvotes: 0
Views: 62
Reputation: 184
Consider using the subprocess module. If you only need to pass the input once (and not have any sort of logic based on the output), you can use the "input" parameter to specify what to pass in through stdin. If you need more flexibility with it (e.g. needing to pass things in multiple times based on the output), you can use the lower-level Popen interface, with the "communicate" method.
Upvotes: 1