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)
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:爬虫 开启定时任务 - Python技术站