省去了线程函数和获取结果的麻烦
threadit的Python项目详细描述
Python Threadit
毫不费力地在线程中运行函数
一个很好的包,可以帮助您在线程中运行函数并获得结果。
正在开发中!因此,请在更新之前检查是否有更改
安装
pip install threadit
用法
^{pr2}$主命令
# Import the modulefromthreaditimportThreadIT# Start your function with or without argumentsvar=ThreadIT(function,args,kwargs)# Wait for the function to finnish or get the result if its finishedvar.result()
可选命令
# Check if your thread is still working on the function.# This will return True if the function is not completed.var.doing_work()# Terminate the thread. This will noe wait for the function to # finnish and will return None as result if the function is not# done within the timelimit setvar.result(timeout=10)
测试
使用以下命令运行测试。在
python -m unittest threadit.tests.test_threadit
变更日志:
看到了吗变更日志.md在
- 项目
标签: