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

相关推荐
Omics Pro2 分钟前
预测性虚拟细胞中显式机理算子
大数据·数据库·人工智能·python·算法·机器学习·自然语言处理
秋名RG13 分钟前
Java历代LTS版本新特性详解(代码增强版)
java·开发语言·python
276695829215 分钟前
youdao/有道翻译APP 算法协议分析
开发语言·前端·python·sign·youdao·有道翻译app算法·有道app协议请求
夏天拐跑了西瓜8 小时前
一文入门LangChain:从框架认知到构建你的第一个AI Agent
python·langchain·conda·agent
魔猴疯猿9 小时前
从0到1用Python开发第一个智能体
人工智能·python·深度学习·神经网络·机器学习
xiaoqi019510 小时前
机器学习因子分析实战:从量化特征到可视化决策
人工智能·python·机器学习
Escalating_xu10 小时前
【Python】基础语法(1):常量、变量、类型、输入输出与运算符
开发语言·python
happylifetree11 小时前
Python14:核心语法-数据存储与运算-字符串定义
python
hhb_61811 小时前
AIRAGDebug:一键定位RAG链路异常
人工智能·python·算法
小静AI工程实验室11 小时前
asyncio.Queue 有界队列实战:背压、task_done、join 与异常收尾
python