I would like to write a program that responds to inputs from the command line. Typically, I will start the program from the command line:
c:\>python my_responder.py
It will then give me a prompt:
responder> Hello. Please type your question.
responder> _
I will then type something, and hit enter:
responder> How many days are there in one week?
The responder will then reply with the result of a function (the input of which is the typed string). e.g.
def respond_to_input(input):
return 'You said: "{}". Please type something else.'.format(input)
responder> You said: "How many days are there in one week?". Please type something else.
I cannot seem to connect this kind of command line input / output to a function in python.
Additional Info: I have no understanding of stdin/stdout, and they feel relevant. I also have no understanding of how to get Python to interact with command line in general (other than running one python program that can print to the window).