多线程,创建子线程案例:

 

import time

import threading

 

def my_task():

    getTask()

    print('循环任务开启.')

    while True:

        time.sleep(1*60*60) # 每小时执行一次

        getTask()

 

thread=threading.Thread(target=my_task)

thread.start()