python生成exe启动很慢_python做的自动关机,输入后总显示运行,太慢了,有解决方法吗? 以下两个程序都响应慢...

importos,time,syso="c:\\windows\\system32\\shutdown-s"print"Inputthehoursandminutes:"h=input()mt=input()t=time.localtime()y,m,d,h1,mt1=t[:5]if(h

import os,time,sys

o="c:\\windows\\system32\\shutdown -s"

print "Input the hours and minutes:"

h=input()

mt=input()

t=time.localtime()

y,m,d,h1,mt1=t[:5]

if(h

print "The time has been pass"

elif(h==h1 and mt

print "The time has been pass"

hm=(y,m,d,h,mt)

while 1:

t=time.localtime(time.time())

a=t[:5]

if(a==hm):

print "Time is coming"

os.system(o)

break

time.sleep(31)

****************************************************************

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);

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值