利用os模块可以执行cmd命令,利用这一点可以实现定时关机,然而在等待关机的过程中也不能啥都不干,于是多线程派上了用场。
#!.../usr/bin/env python
#coding=utf-8
#这里需要引入三个模块
import time, os, sched, easygui, thread
# 第一个参数确定任务的时间...,返回从某个特定的时间到现在经历的秒数
# 第二个参数以某种人为的方式衡量时间
schedule = sched.scheduler(time.time, time.sleep)
def...,从现在起第n秒开始启动
schedule.enter(inc, 0, perform_command, (cmd, inc))
# 持续运行,直到计划时间队列变成空为止...after 10 seconds:")
thread.start_new_thread(reminder, ("shutdown -s", 10))
print'在这个等待过程中并不耽误我们干一些其他事情