I am programming in Python. I have such a while loop
b=time.clock()
while time.clock()-b<3 :
input("input")
I want to end the while loop after exactly 3 seconds, even if the user has not yet entered anything ! How can I do that?
Edit: What would it be if I had data=s.recv(1024)
where s is a socket, rather than input("input")
?
Is there a general solution to such a problem?
Edit2: I am using Python 3.