导语:
本文主要介绍了关于怎么停止python脚本的相关知识,包括终止python运行,以及南京栖霞区有序解除临时管控这些编程知识,希望对大家有参考作用。
1、time.sleep(secs)
参考文档原文:
Suspend execution for the given number of seconds. The argument may be a floating point number to
indicate a more precise sleep time. The actual suspension time may be less than that requested because
any caught signal will terminate the sleep() following execution of that signal's catching routine.
Also, the suspension time may be longer than requested by an arbitrary amount because of the
scheduling of other activity in the system.
大意:
暂停程序执行指定的秒数。该参数可以是浮点类型来指定确切的时间,但实际的程序暂停时间可能比请求的时间长,也可能比暂停时间短。
2、raw_input( )
通过等待输入来让程序暂停。
3、os.system("pause")
通过执行来自操作系统的命令来暂停程序,这是通过实现标准 C 函数 system() 来实现的。
Python 2.4 新增了 subprocess 模块,官方推荐使用修改后的模块替换 os.system。因此,也可以这样写:
subprocess.call("pause",shell=True)
众多
,尽在python学习网,欢迎在线学习!
本文为原创文章,版权归知行编程网所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ Python邮箱:自动启动,不漏掉重要信息11/21
- ♥ 如何用python3输出dos命令?01/07
- ♥ python matlab库的用途是什么?11/17
- ♥ python描述符是什么意思11/10
- ♥ python如何导入请求包09/14
- ♥ 如何加速 Python 语言的全排列?11/09
内容反馈