How to Exit From the Python Command Line

Vaibhav Vaibhav Feb 02, 2024
How to Exit From the Python Command Line

Python Interpreter can be activated from any command line by typing python. Once activated, it can be used to write code and run it. Once the interpreter has started, the usual command-line utilities can’t be used unless we exit from the Python interpreter. There are a few ways to exit the Python interpreter. This article talks about them.

Ways to Exit the Python Interpreter

Following are the ways to exit the Python Interpreter.

  1. Type exit(): Note that it is exit() but not exit. It is a function call.
  2. On Windows, use the key combo Ctrl + Z + Enter.
  3. On UNIX Systems, use the key combo Ctrl + D.
Vaibhav Vaibhav avatar Vaibhav Vaibhav avatar

Vaibhav is an artificial intelligence and cloud computing stan. He likes to build end-to-end full-stack web and mobile applications. Besides computer science and technology, he loves playing cricket and badminton, going on bike rides, and doodling.