How to terminate a Python script

前端 未结 10 1074
予麋鹿
予麋鹿 2020-11-22 04:34

I am aware of the die() command in PHP which exits a script early.

How can I do this in Python?

10条回答
  •  囚心锁ツ
    2020-11-22 04:48

    from sys import exit
    exit()
    

    As a parameter you can pass an exit code, which will be returned to OS. Default is 0.

提交回复
热议问题