有时候困了,想睡觉,又想听歌,但是给电有限制,所以就写了这个小程序,这样就不担心睡着了后,没法关机了。
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<h1):
print "The time has been pass"
elif(h==h1 and mt<mt1):
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)