Hot python input loop

Posted by Josh K on Stack Overflow See other posts from Stack Overflow or by Josh K
Published on 2010-06-16T01:20:09Z Indexed on 2010/06/16 1:42 UTC
Read the original article Hit count: 270

Filed under:
|
|
|

I'd like to have something similar to the following pseudo code:

while input is not None and timer < 5:
    input = getChar()
    timer = time.time() - start

if timer >= 5:
    print "took too long"
else:
    print input

Anyway to do this without threading? I would like an input method that returns whatever has been entered since the last time it was called, or None (null) if nothing was entered.

© Stack Overflow or respective owner

Related posts about python

Related posts about input