Tag Archives: timeout

python调用函数超时设置

1、Windows中sign报错,Linux能很好的使用: https://pypi.python.org/pypi/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() 2、Windows可以使用,Linux报错不能导入包 https://pypi.python.org/pypi/func_timeout from func_timeout import func_set_timeout, FunctionTimedOut @func_set_timeout(2.5) def mytest2():     print("Start")     for i… Read More »