![]() Input of statements, handling of a blank line may differ depending on the Blank lines ¶Ī logical line that contains only spaces, tabs, formfeeds and possibly aĬomment, is ignored (i.e., no NEWLINE token is generated). ImplicitlyĬontinued lines can also occur within triple-quoted strings (see below) in thatĬase they cannot carry comments. There is no NEWLINE token between implicit continuation lines. The indentation of theĬontinuation lines is not important. Implicitly continued lines can carry comments. The recommended forms of an encoding expression are If it is the second line, the first line must also be a comment-only line. The encoding declaration must appear on a line of its Regular expression coding\s*(+), this comment is processed as anĮncoding declaration the first group of this expression names the encoding of If a comment in the first or second line of the Python script matches the Of the logical line unless the implicit line joining rules are invoked. Literal, and ends at the end of the physical line. Comments ¶Ī comment starts with a hash character ( #) that is not part of a string Representing ASCII LF, is the line terminator). The standard C conventions for newline characters (the \n character, When embedding Python, source code strings should be passed to Python APIs using The end of input also servesĪs an implicit terminator for the final physical line. ![]() All of theseįorms can be used equally, regardless of platform. Or the old Macintosh form using the ASCII CR (return) character. The Windows form using the ASCII sequence CR LF (return followed by linefeed), Termination sequences can be used - the Unix form using ASCII LF (linefeed), In source files and strings, any of the standard platform line Physical lines ¶Ī physical line is a sequence of characters terminated by an end-of-line A logical line isĬonstructed from one or more physical lines by following the explicit or Syntax (e.g., between statements in compound statements). StatementsĬannot cross logical line boundaries except where NEWLINE is allowed by the The end of a logical line is represented by the token NEWLINE. If the source file cannot be decoded, a Synta圎rror isĪ Python program is divided into a number of logical lines. Python reads program text as Unicode code points the encoding of a source fileĬan be given by an encoding declaration and defaults to UTF-8, see PEP 3120įor details. Lexical analyzer breaks a file into tokens. Tokens, generated by the lexical analyzer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |