Apscheduler Cron触发器未运行

问题描述

我试图在每分钟开始时使用ApScheduler运行任务。当我运行下面的代码时,没有输出。有什么想法吗?

from apscheduler.schedulers.blocking import BlockingScheduler
scheduler = BlockingScheduler()

def hello():
    print('hello')

scheduler.add_job(hello,'cron',minute=1)
scheduler.start()

解决方法

解决了! 原来,获得我想要的功能的方法是使用minute='*'。使用minute=1会在每小时的第一分钟(而不是每分钟的更改)运行hello函数。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...