How to continue the program without waiting for a user input? I want the loop to continue after 2 seconds even without user input, and break if the user type quit. This code is not working, because I need to manually hit enter every time to be able to continue the loop.
while True:
answer = input("please enter quit to stop the program")
time.sleep(2) # wait for 2 seconds for the possible user input "quit"
if answer == "quit":
break
... other code
operation system: windows 7, python 3.6
I have read: Python: wait for user input, and if no input after 10 minutes, continue with program and: raw_input and timeout. I tried the answers for windows and none of them worked. I didn't completely understand them either. Could you please comment on the major steps in the code? Thank you so much!