Another way on unix that doesn't use signals:

import select, sys

print("Enter something: ", end = "")
sys.stdout.flush()
fds = select.select((0,), (), (), 5)
if fds[0] == [0]:
    data = sys.stdin.readline()
    print("You entered:", data)
else:
    print("Too late!")

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

Reply via email to