本文介绍了有时间限制的原始输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何使我的raw_input有时间限制.
I was wondering how I can make my raw_input have a time limit.
我想要类似raw_input =(您想要什么?")然后如果在5秒钟之内没有给出输入,它将打印太迟了"
I want something like raw_input=("What do you want?")and then if an input isn't given in less than 5 seconds, it'd print "too late"
我一直在尝试阅读,但是似乎没有什么可以用于raw_input
I've been trying to read up, but it doesn't seem like anything like this is available for raw_input
推荐答案
使用计时器对象,将其设置为所需的秒数;只需在调用事件对象后使用tje timer函数显示所需的消息即可.
Use a timer object, setting it to the required number of seconds; and just use tje timer function to display the message you want once the event object is invoked.
这篇关于有时间限制的原始输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!