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()

相关推荐
wfeqhfxz25887828 分钟前
条形码识别与定位:基于FCOS框架的多类型条码检测与识别技术详解
python
free-elcmacom9 分钟前
Python实战项目<3>赛制分数分析
开发语言·前端·python·数据分析
赵谨言10 分钟前
基于OpenCV的数字识别系统
大数据·开发语言·经验分享·python
飞天小蜈蚣1 小时前
http协议和django初识
python
路边草随风1 小时前
langchain agent动态变更系统prompt
人工智能·python·langchain·prompt
哥本哈士奇(aspnetx)8 小时前
Streamlit + LangChain 1.0 简单实现智能问答前后端
python·大模型
我一定会有钱8 小时前
斐波纳契数列、end关键字
python
小鸡吃米…9 小时前
Python 列表
开发语言·python
星依网络10 小时前
yolov5实现游戏图像识别与后续辅助功能
python·开源·游戏程序·骨骼绑定
大佐不会说日语~10 小时前
Spring AI Alibaba 的 ChatClient 工具注册与 Function Calling 实践
人工智能·spring boot·python·spring·封装·spring ai