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

相关推荐
查理零世12 分钟前
【蓝桥杯集训·每日一题2025】 AcWing 6134. 哞叫时间II python
python·算法·蓝桥杯
紫雾凌寒21 分钟前
解锁机器学习核心算法|神经网络:AI 领域的 “超级引擎”
人工智能·python·神经网络·算法·机器学习·卷积神经网络
sun lover33 分钟前
conda简单命令
python·conda
Mike_188702783511 小时前
1688代采下单API接口使用指南:实现商品采集与自动化下单
前端·python·自动化
青铜念诗1 小时前
python脚本文件设置进程优先级(在.py文件中实现)
开发语言·python
Dyan_csdn2 小时前
【Python项目】文本相似度计算系统
开发语言·python
pianmian12 小时前
python绘图之回归拟合图
开发语言·python·回归
MiyamiKK572 小时前
leetcode_位运算 190.颠倒二进制位
python·算法·leetcode
伊一线天2 小时前
体验用ai做了个python小游戏
人工智能·python·pygame
高力士等十万人2 小时前
OpenCV二值化处理
python·opencv·计算机视觉