0

I am making a program in Python in which I want to request input, but only for a certain period of time. So, I would like to execute this code for 5 seconds:

    print("What is your name?")
    name = input()

What can I use to do this? I am using python 3.3.

KnightOfNi
  • 770
  • 2
  • 10
  • 17
  • 1
    It is little unclear, what do you mean execute it for certain period of time? Do you want to repeatedly execute the code, even after the user enters his name? or Do you want the user to enter name within 5 seconds and then disallow? – vidit Nov 23 '13 at 20:22
  • 2
    [Use select on sys.stdin with timeout](http://stackoverflow.com/a/2904057/227884) – UltraInstinct Nov 23 '13 at 20:25
  • google is helpful,http://stackoverflow.com/questions/2933399/how-to-set-time-limit-on-input – PasteBT Nov 23 '13 at 20:25
  • I want to execute for a certain period of time, then move on (ie if name = None then: ____ else:_____) – KnightOfNi Nov 23 '13 at 21:04

0 Answers0