Interactive mode
Getting started
If you already have Python installed, to switch to interactive mode you just need to enter the command
python
without arguments
For Windows you can download and install the Python interpreter.
the signs >>> mean that we are working in interactive mode rather than running programs from a file.
If a message is not preceded by the >>> or … signs, then this message was output by the interpreter.
For example, in the picture above,
the next-to-last line is the interpreter's output
Be careful no to fall off!
The ellipsis means that the line is a continuation of a multi-line statement.
To start entering a statement on the next line, you need to put a colon at the end of the first statement. Note the
example: after the word the_world_is_flat there is :
To finish a multi-line statement, press Enter twice.
The import statement in interactive mode
If you cannot apply the import statement, perhaps you and the module are currently in different directories. Run the following commands:
import os
os.getcwd()
Python will print the currently active directory to the screen. If the module is not there, find its directory and change into it with the command
os.chdir('C:\\Users\\andreyolegovich\\python')
Article author: Andrei Olegovich