首页 > 代码库 > 【Python】定时调度

【Python】定时调度

from datetime import datetime
from apscheduler.schedulers.blocking import BlockingScheduler


def tick():
    print(datetime.now())


if __name__ == ‘__main__‘:
    scheduler = BlockingScheduler()
    scheduler.add_job(tick, ‘interval‘, seconds=1.0000000)

    scheduler.start()

  

【Python】定时调度