SyntaxFix
Write A Post
Hire A Developer
Questions
You can use sys.exit() to exit from the middle of the main function.
sys.exit()
However, I would recommend not doing any logic there. Instead, put everything in a function, and call that from __main__ - then you can use return as normal.
__main__