定时关机神器,定时关机神,有了它,你以后再也不为深
定时关机神器,定时关机神,有了它,你以后再也不为深
有了它,你以后再也不为深夜起来关电脑而担忧了,想什么时候关就什么时候关
import os,time;rh=int(time.strftime("%H",time.localtime()));rm=int(time.strftime("%M",time.localtime()));cmd="cmd.exe /k shutdown -s -t 0";c1=True;while c1: try: h=int(raw_input("Please input the hour:")); if h>=0 and h<=23: c1=False; else: continue; except: continue;c2=True;while c2: try: m=int(raw_input("Please input the minute:")); if m>=0 and m<=59: c2=False; else: continue; except: continue;if h==rh: if m<=rm: os.system(cmd); else: time.sleep((m-rm)*60); os.system(cmd);elif h>rh: tem1=(h-rh-1)*3600+(60-rm+m)*60; time.sleep(tem1); os.system(cmd);else: tem2=(23-rh+h)*3600+(60-rm+m)*60; time.sleep(tem2); os.system(cmd);#该片段来自于http://byrx.net
相关内容
- 简单SVM分类器的开源实现,核心代码150行,svm150行,一个
- python在linux系统下获取系统内存使用情况,pythonlinux,"
- 抓取乌云会员信息,抓取会员信息,抓取乌云网站白帽子
- 元类 metaclass,metaclass,python 可以生成任
- python 获取ip代理地址,python获取ip代理,# -*- coding
- 删除windows垃圾文件,删除windows垃圾,#coding:utf-
- 一个简单的类封装,提供简单的web操作,类封装web操作
- Python ms sql和postgresql互相转化表结构,pythonpostgresql,#c
- python写的用WMI检测windows系统信息、硬盘信息、网卡信息
- 在Django中使用group_by,django使用group_by,在Django中怎样使
评论关闭