import os
import time
running = True
command = "shutdown /s"
command_time = "ping 127.0.0.1 -n 10>nul"
print time.strftime('%H%M')
while running:
if time.strftime('%H%M') == "1100":
if os.system(command) == 0:
print 'Successful shutdown the system'
else:
print 'shutdown FAILED'
else:
import time
running = True
command = "shutdown /s"
command_time = "ping 127.0.0.1 -n 10>nul"
print time.strftime('%H%M')
while running:
if time.strftime('%H%M') == "1100":
if os.system(command) == 0:
print 'Successful shutdown the system'
else:
print 'shutdown FAILED'
else:
os.system(command_time)
利用python脚本,可以设定在晚上11点休息,技术改变生活!