David D wrote:
Is there a SIMPLE method that I can have a TIMER count down at a user input
prompt - if the user doesn't enter information within a 15 second period, it
times out.
import signal, sys

def timeout(*args):
    print("Too late!")
    sys.exit(0)

signal.signal(signal.SIGALRM, timeout)
signal.setitimer(signal.ITIMER_REAL, 15)
data = input("Enter something: ")
print("You entered: ", data)

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to