old_raw_input = raw_input

def new_raw_input(prompt):
    result = old_raw_input(prompt)
if sys.stdin is not sys.__stdin__:
    print(result)
return result
raw_input = new_raw_input
How to display the redirected stdin in Python?