# encoding: UTF-8 import threading #Timer(定时器)是Thread的派生类, #用于在指定时间后调用一个方法。 def func(): print 'hello timer!' timer = threading.Timer(5, func) timer.start()
该程序可实现延迟5秒后调用func方法的功能。
希望本文所述对大家的Python程序设计有所帮助。
Copyright © 2019- hids.cn 版权所有 赣ICP备2024042780号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务