Python cancel raw_input/input via writing to stdin?
问题 For starters, I'm on python 2.7.5 and Windows x64, my app is targeted at those parameters. I'm in need of a way to cancel a raw_input after a certain amount of time has passed. Currently I have my main thread starting two child threads, one is the timer (threading.Timer) and the other fires the raw_input. These both return a value to a Queue.queue that the main thread monitors. It then acts on what is sent to the queue. # snip... q = Queue.queue() # spawn user thread user = threading.Thread