0

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

1

1 Answer 1

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.

answered Jan 22, 2019 at 17:02
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.