我需要一个协程等到下周五执行子协程

I need one coroutine wait until next friday for the execution of sub coroutine

我对 python 和 asyncio 完全陌生,所以我需要一些帮助

基本上,我需要让协程休眠到周五 9:00 下午,每周都这样做

schedule_friday_night

async def schedule_friday_night(arg):
    #  schedule mechanism for coroutine to be called every Friday    
      await send_friday_night(arg)

send_friday_night

async def send_friday_night(arg):
      await print(arg)

有很多调度程序库,例如 schedule, sched, appscheduler or even some AMPQ like celery

我推荐的是 appscheduler,它非常强大且易于设置:

from apscheduler.schedulers.blocking import BlockingScheduler

sched = BlockingScheduler() # you can use AsyncIOScheduler too inside asyncio loop

@sched.scheduled_job("cron", day_of_week="fri")
def friday_job():
    print("it's friday!")


sched.start()