【问题标题】:What does it mean exit (0) and exit (1)? [duplicate]退出(0)和退出(1)是什么意思? [复制]
【发布时间】:2017-05-29 04:27:32
【问题描述】:

我的代码看起来像这样,我不清楚 exit (0) 和 exit (other num)。 我给自己一些时间,但我没有足够清楚自己

from sys import exit
class Scene(object):
    def enter(self):
        print "This scene is not yet configured"
        exit(1)

【问题讨论】:

  • 是程序返回给系统的值。通常,值 0 表示“正确退出”,其他值表示失败。
  • 你好,你的意思是它给出了错误消息,对吧?

标签: python python-2.7


【解决方案1】:

exit(0) 表示干净退出,没有错误

exit(1) 表示出现错误,这就是退出的原因

【讨论】:

    猜你喜欢
    • 2018-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-01
    • 1970-01-01
    • 2011-08-19
    相关资源
    最近更新 更多