Python 超时(运行时间太长) 结束进程

时间:2020-07-08 15:18:27   收藏:0   阅读:135
1 import time
2 import eventlet
3 eventlet.monkey_patch()
4 with eventlet.Timeout(2,False):     #设置超时时间为2秒
5     time.sleep(3)
6     print(超过时长的将不再运行)
7 print(其他操作)

输出:

其他操作
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!