手机
当前位置:查字典教程网 >脚本专栏 >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实现的一个p2p文件传输实例

python定时器(Timer)用法简单实例

python创建和使用字典实例详解

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

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

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

python二分法实现实例

Python笔记(叁)继续学习

python定时器使用示例分享

精品推荐
分类导航