手机
当前位置:查字典教程网 >脚本专栏 >python >python定时器(Timer)用法简单实例
python定时器(Timer)用法简单实例
摘要:本文实例讲述了python定时器(Timer)用法。分享给大家供大家参考。具体如下:#encoding:UTF-8importthreadi...

本文实例讲述了python定时器(Timer)用法。分享给大家供大家参考。具体如下:

# encoding: UTF-8 import threading #Timer(定时器)是Thread的派生类, #用于在指定时间后调用一个方法。 def func(): print 'hello timer!' timer = threading.Timer(5, func) timer.start()

该程序可实现延迟5秒后调用func方法的功能。

希望本文所述对大家的Python程序设计有所帮助。

【python定时器(Timer)用法简单实例】相关文章:

python中常用的各种数据库操作模块和连接实例

python选择排序算法的实现代码

python实现的udp协议Server和Client代码实例

python中cPickle用法例子分享

python 字符串split的用法分享

Python自动化测试工具Splinter简介和使用实例

python线程池的实现实例

python的迭代器与生成器实例详解

python算法学习之计数排序实例

python单线程实现多个定时器示例

精品推荐
分类导航