编程语言
首页 > 编程语言> > python3 定时器Timer

python3 定时器Timer

作者:互联网

# -*- coding: utf-8 -*-
from threading import Timer


def talk(name):
    print("%s is talking." % name)


if __name__ == '__main__':
    '''Timer(等待多少秒, 执行的函数, args给函数传参数)'''
    timer = Timer(3, talk, args=("lily",))
    timer.start()

# lily is talking.

 

标签:__,定时器,name,args,Timer,talking,lily,python3
来源: https://www.cnblogs.com/lilyxiaoyy/p/11032639.html