Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

Python exit commands - why so many and when should each be used

Asked by Liam Nelson Jul 27, 2021 1.7K views 1 answer
Share

About this question

It seems that python supports many different commands to stop script execution.

The choices I've found are: 

quit()
exit()
sys.exit()
os._exit()


Have I missed any? What's the difference between them? When would you use each? How to exit program in python?

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.