Categories
Python Answers

How to terminate a script with Python?

Spread the love

Sometimes, we want to terminate a script with Python.

In this article, we’ll look at how to terminate a script with Python.

How to terminate a script with Python?

To terminate a script with Python, we can use the sys.exit method.

For instance, we write:

import sys

sys.exit()

to exit the script.

Conclusion

To terminate a script with Python, we can use the sys.exit method.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *