某个时间段关闭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之间,那么接口是关闭的
另一种比较好的写法
本文来自博客园,作者:前方、有光,转载请注明原文链接:https://www.cnblogs.com/52-qq/p/10231832.html