python2.7.4本身还有BUG吧?比如这段关机脚本。
import time
import os
def Countdown():
try:
while 1:
timer = time.localtime()
timer1 = timer
if timer.tm_hour == timer1.tm_hour:
print('ShutDown')
os.system('shutdown -s')
break
print(u'条件不成立')
time.sleep(1)
except:
print(u'程序异常')
raw_input()
if __name__ == '__main__':
Countdown()
import win32api
win32api.InitiateSystemShutdown()