python 程序 超时退出

import time
import eventlet#导入eventlet这个模块
eventlet.monkey_patch()#必须加这条代码
with eventlet.Timeout(5,False):#设置超时时间为2秒
  time.sleep(4)
  print('没有跳过这条输出')
print('跳过了输出')

参考
https://www.94e.cn/info/5520

猜你喜欢

转载自blog.csdn.net/nongcunqq/article/details/113663177