Planen Sie Asyncio Python

from datetime import datetime
import os

#pip3 install APScheduler
from apscheduler.schedulers.asyncio import AsyncIOScheduler

try:
    import asyncio
except ImportError:
    import trollius as asyncio


def big_work():
    print("i'm doing a big work")


if __name__ == '__main__':
    scheduler = AsyncIOScheduler()
    scheduler.add_job(big_work, 'interval', seconds=3)  # every sec
    scheduler.start()
    print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))

    # Execution will block here until Ctrl+C (Ctrl+Break on Windows) is pressed.
    try:
        asyncio.get_event_loop().run_forever()
    except (KeyboardInterrupt, SystemExit):
        pass
Shanti