某个时间段关闭API

def bet():
    if 000000 < int(time.strftime("%H%M%S", time.localtime())) < 90000:
        print("True")
        return True
    else:
        print("False")
        return False
    print("xxxxxx")
bet()

如果在晚上0:00到早上9:00之间,那么接口是关闭的

另一种比较好的写法

 

posted @ 2019-01-07 10:35  前方、有光  阅读(145)  评论(0编辑  收藏  举报