1
我正在处理的程序需要暂停并询问用户输入,如果没有,请继续使用该程序。我认为它看起来像这样:请求用户输入python中的有限时间
import time
...[code to run before break]...
if input in time.sleep(5):
[break out of normal code]
else:
[return to normal code]
[code to run after break]...
有什么想法?
编辑:没有想到这个,当我问,但我运行Windows(8.1)。
谷歌是你的朋友编码... http://stackoverflow.com/questions/1335507/keyboard-input-with-timeout-in-python [1]:HTTP:// stackoverflow.com/questions/1335507/keyboard-input-with-timeout-in-python – FlyingGuy 2015-02-10 04:10:33
没有想到使用单词“超时”。这就解释了为什么我无法在google上获得结果。 – unknown 2015-02-10 04:20:52