PYTHON使用小结

线程使用

python 复制代码
import threading

thread01 = None

def ThreadFunc(param)
    xxxxx


def Test()
    global thread01 
    thread01 = threading.Thread(target=ThreadFunc)
    thread01.daemon = True  #设置为TRUE,主线程结束后,此线程也会退出, 默认False
    thread01.start()
    
    

也可以在创建线程时给参数

thread01 = threading.Thread(target=ThreadFunc,name="t1",daemon=True)

等待线程中止

thread01.join()

相关推荐
程序员小远1 小时前
接口测试知识总结
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·接口测试
增量星球1 小时前
一个 Python 脚本 + LLM 怎么替代向量检索?ProjQA 技能架构原理深度解析
开发语言·python·架构·embedding·skill
SamChan901 小时前
Python+PyMuPDF提取PDF表格并翻译:表格结构检测与双语重建实战
windows·python·ai·pdf·wpf
weixin_307779131 小时前
PySpark根据输入的表名和过滤条件生成 INSERT 语句
python·spark·云计算·big data
GodSure09141 小时前
Java单一职责原则SRP详解
java·python·单一职责原则
Mojitocean1 小时前
Win开发环境配置(持续更新)
开发语言·python
千里码aicood1 小时前
flask基于数字人的储粮知识问答原型系统研究与实现
后端·python·flask
E_ICEBLUE2 小时前
Python 实现 Markdown 转 Word、PDF:从转换到页面设置
python·pdf·word·markdown·格式转换
哒咩哒咩1292 小时前
Agent 智能体开发全攻略:从 ReAct 到企业级架构
python·langchain·fastapi