简体   繁体   English

Python在几秒钟后超时

[英]Python timeout a function after some seconds

I need to time out a python function after specific time 我需要在特定时间后使python函数超时

def getDetails(id):
    Logic which takes more time

I need to timeout particular function after 5 seconds something like 我需要在5秒后使特定功能超时,例如

timeout(getDetails(id),5)

Thanks in advance 提前致谢

Try this 试试这个

He defines a custom error that will be raised after a certain timeout period. 他定义了一个自定义错误,该错误将在一定的超时时间后引发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM