定时关机神器,定时关机神,[Python]代码im
定时关机神器,定时关机神,[Python]代码im
[Python]代码
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);
相关内容
- 文本搜索 矩阵重建,文本矩阵重建,简述:一个含有如
- 一个简单的二叉树实现,简单二叉树实现,[Python]代码
- Python unicode码转utf8,pythonutf8,[Python]代码de
- 一个非常高效的提取内容关键词的python代码,提取关键
- python使用连分数计算常数e,python分数常数e,# Calculatin
- python通过ftplib登录到ftp服务器,pythonftplib,import ftpli
- Python和Singleton (单件)模式实现代码,pythonsingleton,我
- 批量修改cisco交换机密码,修改cisco交换机,# -*- coding
- 根据mp3文件的tag重命名mp3文件,mp3文件tag重命名,此脚本
- 点灯游戏及其求解,点灯游戏求解,Python语言: 点灯
评论关闭