python定时关机小脚本
作者:asmcvc 时间:2022-09-24 23:38:21
本文实例为大家分享了python定时关机的具体代码,供大家参考,具体内容如下
# coding: utf-8
import sys
import os
import time
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()
来源:https://blog.csdn.net/asmcvc/article/details/50857861
标签:python,关机
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
在matlab中创建类似字典的数据结构方式
2021-07-08 01:22:53
![](https://img.aspxhome.com/file/2023/5/107475_0s.jpg)
Python编程之基于概率论的分类方法:朴素贝叶斯
2023-10-08 10:15:52
![](https://img.aspxhome.com/file/2023/2/63262_0s.png)
Django配置kafka消息队列的实现
2023-07-19 00:49:27
python数据处理之Pandas类型转换的实现
2021-04-11 11:17:36
![](https://img.aspxhome.com/file/2023/4/65864_0s.png)
pytorch获取模型某一层参数名及参数值方式
2022-07-03 06:10:28
Python3.5面向对象编程图文与实例详解
2023-12-04 23:21:51
![](https://img.aspxhome.com/file/2023/8/88008_0s.png)
php短视频源码之瀑布流分割线左右间距问题及解决代码
2023-06-12 00:27:07
python中dict()的高级用法实现
2022-06-16 23:24:29
![](https://img.aspxhome.com/file/2023/2/84122_0s.png)
php递归删除目录与文件的方法
2023-09-12 02:02:02
Python数据分析之绘制ppi-cpi剪刀差图形
2023-01-10 09:57:03
![](https://img.aspxhome.com/file/2023/5/120445_0s.webp)
发个js从样式表取值的函数
2008-05-20 12:23:00
PHP源码之 ext/mysql扩展部分
2023-07-21 18:24:20
Golang中panic的异常处理
2023-10-13 12:27:23
一个sql查询器,自动画表格填字段
2011-04-10 10:58:00
python global关键字的用法详解
2023-12-30 03:32:02
python数据预处理之将类别数据转换为数值的方法
2023-04-17 21:43:18
运行SQL Server的计算机间移动数据库
2009-01-20 13:07:00
Mootools常用方法扩展(三)
2009-01-14 20:07:00
使用keras时input_shape的维度表示问题说明
2023-05-10 02:52:25
![](https://img.aspxhome.com/file/2023/3/92193_0s.jpg)
浅谈Python中列表生成式和生成器的区别
2023-03-21 11:50:39