Difference between exit(0) and exit(1) in Python

前端 未结 5 1535
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 16:27

What\'s the difference between exit(0) and exit(1) in Python?

I tried looking around but didn\'t find a specific question on these lines. I

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 17:05

    exit(0): This causes the program to exit with a successful termination.

    exit(1): This causes the program to exit with a system-specific meaning.

    On many systems, exit(1) signals some sort of failure, however there is no guarantee.

    As I recall, the C standard only recognizes three standard exit values:

    • EXIT_SUCCESS -- successful termination
    • EXIT_FAILURE -- unsuccessful termination
    • 0 -- same as EXIT_SUCCESS

提交回复
热议问题