python 定时任务之 schedule

飞翔的企鹅 / 2024-10-06 / 原文

import schedule
import time

def task():
    print("任务启动了!")

# 安排任务在16:59:59运行
schedule.every().day.at("16:59:59").do(task)

while True:
    schedule.run_pending()
    time.sleep(1)