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('其他操作')

输出:

其他操作

相关文章:

  • 2021-11-28
  • 2021-06-09
  • 2021-12-03
  • 2021-11-22
  • 2022-01-17
  • 2021-05-21
  • 2021-08-27
  • 2021-07-21
猜你喜欢
  • 2022-12-23
  • 2021-07-08
  • 2021-10-04
  • 2021-12-24
  • 2022-12-23
相关资源
相似解决方案