python 通关sleep函数等待到明天再执行

2021-11-02 13:35:32 浏览数 (1)

python 通关sleep函数等待到明天再执行

代码语言:javascript复制
def waitToTomorrow():
    """Wait to tommorow 00:00 am"""

tomorrow = datetime.datetime.replace(datetime.datetime.now()   datetime.timedelta(days=1),
                     hour=0, minute=0, second=0)
delta = tomorrow - datetime.datetime.now()
time.sleep(delta.seconds)</pre> 

0 人点赞