所以我试图弄清楚为什么选择不适用于调度程序。目前它不会每次都选择新的说法。调度程序运行良好,并且我在其他情况下成功使用了选择。
那么我在这里做错了什么?如果该信息有用,我也会通过解释器说“import [project name]”来运行它。
谢谢!
from apscheduler.scheduler import Scheduler
from random import choice
#change this to a text file
cat_sayings = [
"I can haz?",
"I pooped in your shoe.",
"I ate the fish.",
"I want out.",
"Food? What...? Food?",
"When are you coming home? There's food that needs eating!",
"Lulz, I am sleeping in your laundry.",
"I didn't do it. Nope."]
sayings = choice(cat_sayings)
def cat_job(sayings):
print sayings
s = Scheduler()
s.add_cron_job(cat_job, args=[sayings], second='*/30')
s.start()