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

相关推荐
Dxy12393102161 分钟前
中文乱码恢复方案
开发语言·python
rongyili881 小时前
Dify 外部知识库集成 Milvus 实战指南
开发语言·python·milvus
Hello eveybody1 小时前
什么是动态规划(DP)?(Python版)
python·动态规划
南 阳2 小时前
Python从入门到精通day34
开发语言·python
APIshop3 小时前
阿里巴巴中国站按图搜索1688商品(拍立淘)API 返回值说明
java·python·图搜索算法
哈库纳玛塔塔3 小时前
dbVisitor 利用 queryForPairs 让键值查询一步到位
java·数据库·python
sa100274 小时前
京东评论接口调用、签名生成与异常处理
开发语言·数据库·python
赵谨言4 小时前
基于Python实现地理空间数据批处理技术探讨及实现--以“多规合一“总体规划数据空间叠加分析为例
大数据·开发语言·经验分享·python
DN20204 小时前
AI销售:从不迟到早退,永远秒回,您的忠实员工
人工智能·python
编程之升级打怪4 小时前
Python的图形框架tkinter使用案例
python