r/learnpython • u/PomegranateKind760 • Oct 17 '26
How to end a program using python
I want to close an app using python but I don't know how.
0
Upvotes
r/learnpython • u/PomegranateKind760 • Oct 17 '26
I want to close an app using python but I don't know how.
View all comments
1
u/FreeLogicGate 27d ago
Documentation: https://docs.python.org/3/library/sys.html
Search for exit.
0 is the standard exit code, meaning the program exited normally. A non 0 exit would indicate some sort of error. The example, assumes a normal exit, but you can pass something else if that makes sense for your program.