代码语言:javascript复制
python3.6 -m pip install croniter
代码语言:javascript复制import croniter
import datetime
def run_get_next_time(sched):
now = datetime.datetime.now()
cron = croniter.croniter(sched, now)
return [cron.get_next(datetime.datetime).strftime("%Y-%m-%d %H:%M")][0]
print(run_get_next_time("* * * * *"))