Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
terminating input() function after specified time
I need to get user input (via keyboard) but if the user does not respond within a certain time interval (i.e. 3sec), the program needs to abort the user input function and move on to the next stage of the program.
I have been trying to use the 'input()' function but there doesn't seem a way to exit from the function if no user input has been supplied. I have tried using the timer object but still run into the same problem.
Any ideas? Its probably very simple but the solution is not presenting itself to me!
0 · ·