delay a task until certain time

后端 未结 8 2091
梦谈多话
梦谈多话 2021-01-11 11:59

What I want to do in a python script is sleep a number of seconds until the required time is reached. IE: if runAt setting is 15:20 and current time is 10:20, how can I wor

8条回答
  •  南笙
    南笙 (楼主)
    2021-01-11 12:29

    You could instead use the pause package [ https://pypi.python.org/pypi/pause/0.1.2 ]. Taking an example from their documentation -

    import pause, datetime
    dt = datetime.datetime(2013, 6, 2, 14, 36, 34, 383752)
    pause.until(dt)
    

提交回复
热议问题