Get current console output(sys.stdin) in python

49 views Asked by At

I want to get the current console output(sys.stdin) of my program in python. I found the answer for sys.stdout, however, I found out for the output caused by input() function it goes to sys.stdin stream.

For example,

input("Where are you from: ")
input_text = get_console_input() #"Where are you from: "

I tried this method(Get current console output in python) by replacing sys.stdout to sys.stdin, but it caused "EOFError: EOF when reading a line"

Edit: The output from input function still can be found on standard output stream!

0

There are 0 answers