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
Asked
Active
Viewed 52 times
0
-
Is this a potential duplicate of [How to read/process command line arguments?](https://stackoverflow.com/q/1009860/945456) – Jeff B Jan 22 '19 at 17:03
1 Answers
1
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.

kuhnertdm
- 144
- 5