

With Linux you can simply to Ctrl + D and on Windows you need to press Ctrl + Z + Enter to exit. There are other ways to exit the interactive Python script mode too. You should be back to the command line screen that you started with initially. To exit interactive Python script mode, write the following: >exit()Īnd, hit Enter. So, what you see after print(i) is the output here. Our code snippet was written to print everything including 0 and upto 5. With interactive Python script mode, you can write code snippets and execute them to see if they give desired output or whether they fail. Once you hit enter you should see something like this: On Windows, go to your Command Prompt and write “python”. Interactive Python Scripting Mode On Windows

The image below shows the interactive mode on Mac OS. Launching interactive Python script mode on Mac OS is pretty similar to Linux.
RUN A PYTHON SCRIPT FROM TERMINAL MAC OSX
Interactive Python Scripting Mode On Mac OSX Type "help", "copyright", "credits" or "license" for more information.Įnter the Python script interactive mode after pressing “Enter”. Interactive Python Scripting Mode On Linux Here’s how you enter interactive mode in Windows, Linux and MacOS. And, as soon as you hit enter, you’ll be in the interactive mode. To start an interactive session for Python code, simply open your Terminal or Command line and type in Python(or Python 3 depending on your Python version).
