quit() Quit (alias of exit)

Last updated: 2026-09-22

quit() Quit (alias of exit)

quit() is an alias of exit(); also raises SystemExit.

CategoryBuilt-in Functions
KindBuilt-in Function
Python Versionall

📝 Syntax

quit([code])

⚙️ Parameters

code OptionalExit code (int or None).(Default:None)

Returns:Never returns: raises SystemExit (same as exit()).

💥 Raises

▶ Example

Edit the code, press Run, and see the result in the output panel:

Output:

quit code: 1
More case studies coming soon — check back later.

❓ FAQ

QIs quit() exactly the same as exit()?
AYes — quit() is an alias of exit(), with identical SystemExit behavior and exit-code semantics.
QCan quit() exit a script normally?
AYes, but like exit() it is designed as an interactive tool; in a script, sys.exit(code) is recommended for clearer semantics.
QWhy do some people use quit and others exit?
APurely personal habit — they are fully equivalent; in the REPL both are actually objects provided by the site module and behave identically.
QWhat is the argument of quit(code) for?
AThe exit code: 0 means a normal exit and non-zero means an abnormal exit; an external process can judge the program's result from this value.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏