网站建设资讯

NEWS

网站建设资讯

Pythonsys.exit([arg])怎么使用

本篇内容介绍了“Python sys.exit([arg])怎么使用”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

10年积累的网站设计、网站建设经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先做网站后付款的网站建设流程,更有龙陵免费网站建设让你可以放心的选择与我们合作。

Python sys.exit([arg])怎么使用

函数功能说明:

退出程序,传入参数0表示正常退出.
传入参数非0代表非正常退出.
传入字符串可以用来打印出错信息.

代码实验举例:

Microsoft Windows [版本 10.0.18363.1256](c) 2019 Microsoft Corporation。保留所有权利。

C:\Users\chenxuqi>conda activate ssd4pytorch2_2_0(ssd4pytorch2_2_0) C:\Users\chenxuqi>python
Python 3.7.7 (default, May  6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>>>>> sys.exit(0)(ssd4pytorch2_2_0) C:\Users\chenxuqi>python
Python 3.7.7 (default, May  6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.exit(1)(ssd4pytorch2_2_0) C:\Users\chenxuqi>python
Python 3.7.7 (default, May  6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.exit('程序出错,提前退出,林麻子!!!')程序出错,提前退出,林麻子!!!(ssd4pytorch2_2_0) C:\Users\chenxuqi>(ssd4pytorch2_2_0) C:\Users\chenxuqi>python
Python 3.7.7 (default, May  6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.exit("some error message")some error message(ssd4pytorch2_2_0) C:\Users\chenxuqi>(ssd4pytorch2_2_0) C:\Users\chenxuqi>(ssd4pytorch2_2_0) C:\Users\chenxuqi>

“Python sys.exit([arg])怎么使用”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


网站名称:Pythonsys.exit([arg])怎么使用
URL链接:http://cdweb.net/article/gjoepp.html