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

相关推荐
2601_9669496519 分钟前
如何封装 qd.klines.batch(),让批量 K 线查询函数在多个策略中复用?
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
神仙别闹1 小时前
基于Python实现英词语自动对齐系统
开发语言·python
老歌老听老掉牙2 小时前
圆柱端面四平面交线及其在yoz面投影的几何解析与 Python 实现
开发语言·python·平面
我要见SA姐12 小时前
Chrome 扩展安全攻防实录:从权限滥用到供应链投毒
运维·人工智能·python·机器学习·自动化
2601_962885723 小时前
给 backtrader 接 A 股数据:用 AlphaFeed 喂PandasData
python
YYYing.3 小时前
【Agent系列 (十一) 】上下文工程
人工智能·python·ai·agent·上下文工程
计算机毕业编程指导师3 小时前
基于深度学习的光伏组件红外图像缺陷识别系统设计与实现
人工智能·python·深度学习·目标检测·毕业设计·课程设计·光伏
前端精髓4 小时前
langchain 短期记忆(状态)动态运行时上下文
python·langchain
最强小杰5 小时前
DeepSeek V4 Flash + Codex CLI 接入教程:原生 Responses API 适配,从配置到跑通收藏这篇就够了(2026)
java·前端·python·ai
DeepVisionary5 小时前
为拿并网许可,OpenAI在佐治亚新园区同意高峰期断电三成
python·自动化