Prevent reading of previous / prior user keyboard input from sys.stdin, that works with Click
问题 Say you want to ask the user something from the terminal at the end of your program. However, during the program run, the user pressed the enter key. import sys import time print("Hit enter now to see this 'problem'") time.sleep(1) # Hit enter now while the program sleeps! a=input("Do you want to delete something that is really bad to delete? [Y|n]") if a.lower()!="n": print("\nNO! YOU DELETED IT!") Of course, it's stupid to delete stuff with default response, and I don't do that. However, It