8.3 交互式输入 Interactive input

Input in interactive mode is parsed using the following grammar:

交互模式输入使用以下语法进行解析:

interactive_input  ::=  [stmt_list] NEWLINE | compound_stmt NEWLINE
Download entire grammar as text.

Note that a (top-level) compound statement must be followed by a blank line in interactive mode; this is needed to help the parser detect the end of the input.

请注意一个(顶层)复合语句后面在交互模式下必须跟着一个空行;需要用它来帮助解释器检测输入的结束。