調整了範例,讓 timer t
可在任意位置取消 timer 的運作,指令 t.cancel()
import threading
# global t
t = None
def set_interval(func, sec):
global t
def func_wrapper():
set_interval(func, sec)
func()
t = threading.Timer(sec, func_wrapper)
t.start()
def call():
print('hello!')
if __name__ == "__main__":
set_interval(call, 3)
[Python 常用] 實現 setInterval 定時器圈呼叫函式功能
實作相關
因不支援副檔名為xmls的檔案,故須透過 offiece 轉成xls,也不能直接從檔名改,否則一樣不支援 Ref. Localizable.strings2Excel
Jun 1, 2022Ref. Python内置库:configparser(INI格式配置文件解析)
Oct 25, 2021Ref. 【python的異常處理】異常的捕捉
Jul 22, 2021Ref. Python 呼叫其他程式
Jul 20, 2021or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up