To exit Python's interactive mode, press Control-D (on Mac or UNIX) or Ctrl-Z (on Windows).
If you type quit, Python reminds you what to do, like this:
Tip If you have Python 2.5, you can still use Control-D or Control-Z (depending on your operating system) to quit, or you can type quit() or exit() (both work on all operating systems). The reminder if you type quit without the parentheses is a little different (this is the reminder on UNIX):
When you exit interactive mode, you return to the command prompt of your Terminal window or Command Prompt window.
Warning When you quit the Python interpreter, all the values you've given names disappear. If you want to keep your work, copy any code you want to save into a text file.
Was this article helpful?