Using the Python Interpreter
On Windows machines, the Python installation is usually placed in
C:\Python37, though you can change this when you’re running the
installer. To add this directory to your path, you can type the following
command into a command prompt window:
Typing an end-of-file character (Control-D on Unix, Control-Z on
Windows) at the primary prompt causes the interpreter to exit with a zero exit
status. If that doesn’t work, you can exit the interpreter by typing the
following command:
quit()
When commands are read from a tty, the interpreter is said to be in interactive
mode. In this mode it prompts for the next command with the primary prompt,
usually three greater-than signs (
>>>); for continuation lines it prompts
with the secondary prompt, by default three dots (...). The interpreter
prints a welcome message stating its version number and a copyright notice
before printing the first prompt:
Continuation lines are needed when entering a multi-line construct. As an
example, take a look at this
if statement:
The Interpreter and Its Environment
Comments
Post a Comment