I am aware of the die() command in PHP which exits a script early.
die()
How can I do this in Python?
A simple way to terminate a Python script early is to use the built-in quit() function. There is no need to import any library, and it is efficient and simple.
quit()
Example:
#do stuff if this == that: quit()