Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python close input timeout

import sys, select
timeout = 5
print(f"You have {timeout} seconds to make your move: ")
i, o, e = select.select([sys.stdin], [], [], timeout)

if (i) :
    entry = sys.stdin.readline().strip()
else :
    entry = 'dEfAuLt vAlUe'

print(f'Variable "entry" is set to "{entry}"')
 
PREVIOUS NEXT
Tagged: #python #close #input #timeout
ADD COMMENT
Topic
Name
5+8 =