Need function like "raw_input", but with time limit

Radioactive Man rm at rm.rm
Sat Sep 18 19:53:52 EDT 2004


anyone know of a function like "raw_input", which collects a string
from the user entry, but one where I can set a time limit, as follows:

time_limit = 10    # seconds
user_answer = function_xyz("GIVE ME AN ANSWER:  ", time_limit)  


The problem with "raw_input" is that it will stop unattended script
indefinitely.  I'm looking for a function that does the exact same
thing, but with a time limit feature, and preferably one that returns
an empty string ('') when it gets no response.  Any suggestions?





More information about the Python-list mailing list