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

相关推荐
qxqycb35 分钟前
python一键反编译工具
python
weixin_BYSJ198743 分钟前
springboot技能与工具共享小程序---附源码29657
java·javascript·spring boot·python·小程序·django·php
weixin_BYSJ19871 小时前
flask民族服饰饰品商城小程序---附源码37399
java·javascript·spring boot·python·小程序·django·php
帅气的小峰1 小时前
pybind11与nanobind可以共存吗?如何迁移?
c++·python·cuda·推理引擎
用户298698530141 小时前
从入门到自动化:TXT 转 Word 的在线工具与代码实战方案
人工智能·后端·python
W_326001 小时前
Python-OpenCV:库、环境搭建、图片与摄像头解析
开发语言·图像处理·python·opencv·机器学习
抓不住时间的沙2 小时前
N1搭建Hexo个人博客,部署到Github
python·docker·node.js·debian·github·arm
W_326002 小时前
Python-OpenCV:画布、图形、文字、调色滑动条
图像处理·python·opencv·机器学习·计算机视觉
Promising_GEO2 小时前
新电脑科研环境配置指南:Miniforge + PyCharm + GitHub 从安装到可用
ide·python·pycharm·github·地理
Patrick在香港2 小时前
Claude API 成本直降90%:Prompt Caching 提示词缓存 Python 实战
python·缓存·prompt