Python程序中的线程操作-线程定时器

一、线程定时器

线程定时器也是定时器,就是定时之后开启一条线程

二、用法

'''
线程定时器,就是规定时间后开启一条线程
'''
def task():
    print('线程执行了')
    time.sleep(2)
    print('线程结束了')

t = Timer(4,task)   # 间隔时间, 功能函数
t.start()
原文地址:https://www.cnblogs.com/XuChengNotes/p/11553061.html