8.2 File input

All input read from non-interactive files has the same form:

file_input  ::=  (NEWLINE | statement)*
Download entire grammar as text.

This syntax is used in the following situations:

  • when parsing a complete Python program (from a file or from a string);

  • when parsing a module;

  • when parsing a string passed to the exec statement;

See About this document... for information on suggesting changes.