Python 3定时输入我想要做的是用输入来问用户一个问题。例如:print('some scenario')prompt = input("You have 10 seconds to choose the correct answer...\n")如果时间流逝,打印如下print('Sorry, times up.')如果能帮助我找到正确的方向,我将不胜感激。
3 回答
慕尼黑8549860
TA贡献1818条经验 获得超11个赞
import timefrom threading import Threadanswer = Nonedef check(): time.sleep(2) if answer != None: return print "Too Slow"Thread(target = check).start()answer = raw_input("Input something: ")
添加回答
举报
0/150
提交
取消