资源简介


资源截图

代码片段和文件信息

import os
import time
from datetime import datetime


def close_job1(times):
    print(
        ‘现在是‘
        time.strftime(
            ‘%Y-%m-%d %H:%M:%S‘
            time.localtime(
                time.time())))
    now = str(datetime.now()).rpartition(“:“)[0].split(“ “)[1]
    now_tosec = (int(now.split(“:“)[0]) * 60 + int(now.split(“:“)[1])) * 60
    t_tosec = (int(times.split(“:“)[0]) * 60 + int(times.split(“:“)[1])) * 60
    diff = int((t_tosec - now_tosec) / 60)
    print(“定时任务启动,系统将在 {},即{}分钟后 自动关闭“ .format(times diff))
    command = “shutdown -s -t {}“.format(diff * 60)
    os.system(command)


def close_job2(times):
    print(
        ‘现在是‘
        time.strftime(
            ‘%Y-%m-%d %H:%M:%S‘
            time.localtime(
                time.tim

评论

共有 条评论