Python: using sys.exit or SystemExit differences and suggestions

后端 未结 7 772
你的背包
你的背包 2020-12-29 17:31

Reading online some programmers use sys.exit, others use SystemExit.
Sorry for the basic question:

  1. What is the difference?
  2. <
7条回答
  •  感动是毒
    2020-12-29 18:07

    No practical difference, but there's another difference in your example code - print goes to standard out, but the exception text goes to standard error (which is probably what you want).

提交回复
热议问题