1、导入模块

import datetime
import time

 

2、代码

def time_task():
    while True:
        now = datetime.datetime.now()
        # print(now.hour, now.minute)
        if now.hour == 0 and now.minute == 0:
            start_spider()
        if now.hour == 6 and now.minute == 0:
            break
        # 每隔60秒检测一次
        time.sleep(60)