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

相关推荐
CTA终结者13 分钟前
示例、拆解和练习,要连成一条量化补课线
人工智能·python
lolijiaqi1514 分钟前
一线观察:长期体验后发现的医疗器械 CDMO 底层现象
大数据·python
spencer_tseng44 分钟前
[j2cache ehcache.xml]/tmp/.ehcache-diskstore.lock (Permission denied)
xml·linux·python·ehcache·[j2cache
梦想不只是梦与想1 小时前
Python Web 框架:FastAPI
python·fastapi·web框架
玩大数据的龙威2 小时前
农经权二轮延包—全面取代人工公示图生成
python·arcgis
IT_Octopus2 小时前
JSON 日志里的 `{“$ref“:“$.xxx“}`:从 fastjson 兼容包到原生 fastjson2 的迁移实录
开发语言·python·json
geovindu2 小时前
python:HandWriting Recognition using paddlepaddle
开发语言·后端·python·paddlepaddle
wuyk5552 小时前
Python 零基础入门第九章:用户输入与 While 循环
开发语言·python
兮动人2 小时前
Python变量与常量
开发语言·python·机器学习·python变量与常量
2601_962300813 小时前
机器学习的理想基石
人工智能·python·机器学习·编程语言·数据处理