在Python中,如果用户在固定的时间内未给出输入,则如何跳到下一个代码?
我正在尝试制作一个程序,以提示用户在周期中进行输入。如果用户在固定的时间内不给出输入,则应以某种方式停止要求输入并再次提供新提示。
我已经尝试了线程的计时器函数,但是在给定时间结束后,它不会执行下一个代码,直到给出输入为止。
如何发挥这样的功能,请指导我。
是否有任何直接停止“输入()”过程的方法。
I am trying to make a program that prompt the user for input in a cycle. If user does not give input in a fixed time, it should somehow stop asking for input and again give a new prompt.
I have tried the Timer function from threading but in it after the given time is over it does not execute the next code until an input is given.
How to make such a function, please guide me.
Is there any direct way to stop the "input()" process.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在Windows上尝试了一些MSVCRT
I tried something with msvcrt on windows