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:
从 tty 读取命令时,我们称解释器工作于 交互模式
。这种模式下它根据 主提示符
来执行,主提示符通常标识为三个大于号( ">>
> ");继续的部分被称为 从属提示符 ,由三个点标识(
"... ")。在第一行之前,解释器打印欢迎信息、版本号和授权提示:
python Python 1.5.2b2 (#1, Feb 28 1999, 00:02:06) [GCC 2.8.1] on sunos5 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>>
Continuation lines are needed when entering a multi-line construct. As an example, take a look at this if statement:
输入多行结构时需要从属提示符了,例如,下面这个 if 语句:
>>> the_world_is_flat = 1 >>> if the_world_is_flat: ... print "Be careful not to fall off!" ... Be careful not to fall off!