码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2019-09-19 23:33:02      阅读:85      评论:0      收藏:0      [点我收藏+]

标签:tar   时间   就是   div   href   toc   star   print   list   

一、线程定时器

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

二、用法

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

t = Timer(4,task)   # 间隔时间, 功能函数
t.start()

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

标签:tar   时间   就是   div   href   toc   star   print   list   

原文地址:https://www.cnblogs.com/XuChengNotes/p/11553061.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!