-
Python的超时装饰器:timeout-decorator
资源介绍
超时装饰器
安装
从源代码:
python setup.py install
从pypi:
pip install timeout-decorator
用法
import time
import timeout_decorator
@timeout_decorator.timeout(5)
def mytest():
print("Start")
for i in range(1,10):
time.sleep(1)
print("{} seconds have passed".format(i))
if __name__ == '__main__':
mytest()
指定备用异常以在超时时引发:
import time
import timeout_decorator
@timeout_decorator.timeout(5
- 上一篇: SmartSniff 绿色版抓包工具
- 下一篇: 网络抓包工具smsniff