import threading
from apscheduler.scheduler import Scheduler
schedudler = Scheduler(daemonic = False)
@schedudler.cron_schedule(second='*/10', minute='*', day_of_week='0-6', hour='7-21')
def send_toeflword():
text = 'Hello World'
print text
print threading.current_thread().name
schedudler.start()
打印结果:
Hello World
Thread-1
Hello World
Thread-2
Hello World
Thread-3
Hello World
Thread-4
Hello World
Thread-5
Hello World
Thread-6
Hello World
Thread-7
Hello World
Thread-8
Hello World
Thread-9
죄송합니다. 확인해 보니 이전 것들은 자동으로 파기되는 것 같습니다.