# coding: utf-8
import os
import time
import importlib,sys
importlib.reload(sys)
#sys.setdefaultencoding("GBK")
# shutdown computer after time_diff seconds
def shutdown(seconds):
print (str(seconds) + u' 秒后将会关机...')
time.sleep(seconds)
print (u'关机啦。。。')
os.system('shutdown -s -f -t 1')
def main():
hour = input(u'延迟关机小时数:')
print (hour)
shutdown(hour * 3600)
if __name__ == '__main__':
main()
Python 小脚本(二)——定时关机
最新推荐文章于 2023-05-21 23:49:00 发布