The problem that I am having is that I want to get an input from the user, however, if no input is given after a set time, then a default value is given. Is this possible in Python?
Asked
Active
Viewed 1,646 times
0
-
2I don't think this is a duplicate (since solutions to the input problem usually involves waiting for a character press..) – thebjorn Nov 16 '15 at 19:22
-
Both links provide several examples (and links to other posts) to achieve what OP is looking for. – idjaw Nov 16 '15 at 19:35
-
This answer works on posix http://stackoverflow.com/a/2933402/4615680 – Joshua Grigonis Nov 16 '15 at 19:37
-
The first linked answer is irrelevant. Alex' answer (http://stackoverflow.com/a/2933423/75103) is close to correct, but will eat CPU (since the sleep is in the wrong branch of the if-statement). – thebjorn Nov 16 '15 at 19:46