|
Original |
Translation |
|
957
|
This syntax is used in the following situations:
|
|
|
958
|
when parsing a complete Python program (from a file or from a string);
|
|
|
959
|
|
|
|
960
|
when parsing a string passed to the :func:`exec` function;
|
|
|
961
|
|
962
|
Input in interactive mode is parsed using the following grammar:
|
|
|
963
|
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.
|
|
|
964
|
|
|
|
965
|
There are two forms of expression input. Both ignore leading whitespace. The string argument to :func:`eval` must have the following form:
|
|
|
966
|
Note: to read 'raw' input line without interpretation, you can use the the :meth:`readline` method of file objects, including ``sys.stdin``.
|
|